mind-elixir 5.3.3 → 5.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MindElixir.css +1 -1
- package/dist/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +658 -655
- package/dist/MindElixirLite.css +1 -1
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +385 -382
- package/dist/types/types/index.d.ts +2 -2
- package/package.json +1 -1
- package/readme.md +5 -0
package/dist/MindElixir.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const be = {
|
|
2
2
|
name: "Latte",
|
|
3
3
|
type: "light",
|
|
4
4
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -24,7 +24,7 @@ const ve = {
|
|
|
24
24
|
"--panel-border-color": "#eaeaea",
|
|
25
25
|
"--map-padding": "50px"
|
|
26
26
|
}
|
|
27
|
-
},
|
|
27
|
+
}, we = {
|
|
28
28
|
name: "Dark",
|
|
29
29
|
type: "dark",
|
|
30
30
|
palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
|
|
@@ -51,15 +51,15 @@ const ve = {
|
|
|
51
51
|
"--map-padding": "50px 80px"
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
function
|
|
54
|
+
function ue(e) {
|
|
55
55
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
56
56
|
}
|
|
57
|
-
const
|
|
57
|
+
const se = function(e, t) {
|
|
58
58
|
if (t.id === e)
|
|
59
59
|
return t;
|
|
60
60
|
if (t.children && t.children.length) {
|
|
61
61
|
for (let n = 0; n < t.children.length; n++) {
|
|
62
|
-
const o =
|
|
62
|
+
const o = se(e, t.children[n]);
|
|
63
63
|
if (o) return o;
|
|
64
64
|
}
|
|
65
65
|
return null;
|
|
@@ -81,35 +81,35 @@ const oe = function(e, t) {
|
|
|
81
81
|
z(o, !1);
|
|
82
82
|
});
|
|
83
83
|
};
|
|
84
|
-
function
|
|
84
|
+
function xe(e) {
|
|
85
85
|
if (e.id = W(), e.children)
|
|
86
86
|
for (let t = 0; t < e.children.length; t++)
|
|
87
|
-
|
|
87
|
+
xe(e.children[t]);
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function ie(e, t, n, o) {
|
|
90
90
|
const s = o - t, i = e - n;
|
|
91
91
|
let l = Math.atan(Math.abs(s) / Math.abs(i)) / 3.14 * 180;
|
|
92
92
|
if (isNaN(l)) return;
|
|
93
93
|
i < 0 && s > 0 && (l = 180 - l), i < 0 && s < 0 && (l = 180 + l), i > 0 && s < 0 && (l = 360 - l);
|
|
94
|
-
const r = 12, c = 30, a = l + c,
|
|
94
|
+
const r = 12, c = 30, a = l + c, h = l - c;
|
|
95
95
|
return {
|
|
96
96
|
x1: n + Math.cos(Math.PI * a / 180) * r,
|
|
97
97
|
y1: o - Math.sin(Math.PI * a / 180) * r,
|
|
98
|
-
x2: n + Math.cos(Math.PI *
|
|
99
|
-
y2: o - Math.sin(Math.PI *
|
|
98
|
+
x2: n + Math.cos(Math.PI * h / 180) * r,
|
|
99
|
+
y2: o - Math.sin(Math.PI * h / 180) * r
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
function W() {
|
|
103
103
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16);
|
|
104
104
|
}
|
|
105
|
-
const
|
|
105
|
+
const ft = function() {
|
|
106
106
|
const e = W();
|
|
107
107
|
return {
|
|
108
108
|
topic: this.newTopicName,
|
|
109
109
|
id: e
|
|
110
110
|
};
|
|
111
111
|
};
|
|
112
|
-
function
|
|
112
|
+
function Ee(e) {
|
|
113
113
|
return JSON.parse(
|
|
114
114
|
JSON.stringify(e, (n, o) => {
|
|
115
115
|
if (n !== "parent")
|
|
@@ -117,7 +117,7 @@ function xe(e) {
|
|
|
117
117
|
})
|
|
118
118
|
);
|
|
119
119
|
}
|
|
120
|
-
const
|
|
120
|
+
const $ = (e, t) => {
|
|
121
121
|
let n = 0, o = 0;
|
|
122
122
|
for (; t && t !== e; )
|
|
123
123
|
n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
|
|
@@ -125,7 +125,7 @@ const O = (e, t) => {
|
|
|
125
125
|
}, k = (e, t) => {
|
|
126
126
|
for (const n in t)
|
|
127
127
|
e.setAttribute(n, t[n]);
|
|
128
|
-
},
|
|
128
|
+
}, pe = (e) => e ? e.tagName === "ME-TPC" : !1, ae = (e) => e.filter((t) => t.nodeObj.parent).filter((t, n, o) => {
|
|
129
129
|
for (let s = 0; s < o.length; s++) {
|
|
130
130
|
if (t === o[s]) continue;
|
|
131
131
|
const { parent: i } = t.nodeObj;
|
|
@@ -133,10 +133,10 @@ const O = (e, t) => {
|
|
|
133
133
|
return !1;
|
|
134
134
|
}
|
|
135
135
|
return !0;
|
|
136
|
-
}),
|
|
136
|
+
}), Xe = (e) => {
|
|
137
137
|
const t = /translate\(([^,]+),\s*([^)]+)\)/, n = e.match(t);
|
|
138
138
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
139
|
-
},
|
|
139
|
+
}, Ce = function(e) {
|
|
140
140
|
for (let t = 0; t < e.length; t++) {
|
|
141
141
|
const { dom: n, evt: o, func: s } = e[t];
|
|
142
142
|
n.addEventListener(o, s);
|
|
@@ -147,40 +147,40 @@ const O = (e, t) => {
|
|
|
147
147
|
o.removeEventListener(s, i);
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
|
-
},
|
|
150
|
+
}, D = {
|
|
151
151
|
LHS: "lhs",
|
|
152
152
|
RHS: "rhs"
|
|
153
|
-
},
|
|
153
|
+
}, ut = (e) => {
|
|
154
154
|
const t = e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc");
|
|
155
155
|
e.selectNode(t[Math.ceil(t.length / 2) - 1]);
|
|
156
|
-
},
|
|
156
|
+
}, pt = (e) => {
|
|
157
157
|
const t = e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");
|
|
158
158
|
e.selectNode(t[Math.ceil(t.length / 2) - 1]);
|
|
159
|
-
},
|
|
159
|
+
}, gt = (e) => {
|
|
160
160
|
e.selectNode(e.map.querySelector("me-root>me-tpc"));
|
|
161
|
-
},
|
|
161
|
+
}, mt = function(e, t) {
|
|
162
162
|
const n = t.parentElement.parentElement.parentElement.previousSibling;
|
|
163
163
|
if (n) {
|
|
164
164
|
const o = n.firstChild;
|
|
165
165
|
e.selectNode(o);
|
|
166
166
|
}
|
|
167
|
-
},
|
|
167
|
+
}, yt = function(e, t) {
|
|
168
168
|
const n = t.parentElement.nextSibling;
|
|
169
169
|
if (n && n.firstChild) {
|
|
170
170
|
const o = n.firstChild.firstChild.firstChild;
|
|
171
171
|
e.selectNode(o);
|
|
172
172
|
}
|
|
173
|
-
},
|
|
173
|
+
}, De = function(e, t) {
|
|
174
174
|
const n = e.currentNode || e.currentNodes?.[0];
|
|
175
175
|
if (!n) return;
|
|
176
176
|
const o = n.nodeObj, s = n.offsetParent.offsetParent.parentElement;
|
|
177
|
-
o.parent ? s.className === t ?
|
|
178
|
-
},
|
|
177
|
+
o.parent ? s.className === t ? yt(e, n) : o.parent?.parent ? mt(e, n) : gt(e) : t === D.LHS ? ut(e) : pt(e);
|
|
178
|
+
}, Pe = function(e, t) {
|
|
179
179
|
const n = e.currentNode;
|
|
180
180
|
if (!n || !n.nodeObj.parent) return;
|
|
181
181
|
const s = t + "Sibling", i = n.parentElement.parentElement[s];
|
|
182
182
|
i ? e.selectNode(i.firstChild.firstChild) : e.selectNode(n);
|
|
183
|
-
},
|
|
183
|
+
}, re = function(e, t, n) {
|
|
184
184
|
const { scaleVal: o, scaleSensitivity: s } = e;
|
|
185
185
|
switch (t) {
|
|
186
186
|
case "in":
|
|
@@ -190,7 +190,7 @@ const O = (e, t) => {
|
|
|
190
190
|
e.scale(o - s, n);
|
|
191
191
|
}
|
|
192
192
|
};
|
|
193
|
-
function
|
|
193
|
+
function vt(e, t) {
|
|
194
194
|
t = t === !0 ? {} : t;
|
|
195
195
|
const n = () => {
|
|
196
196
|
e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNodes && e.removeNodes(e.currentNodes);
|
|
@@ -227,21 +227,21 @@ function yt(e, t) {
|
|
|
227
227
|
else {
|
|
228
228
|
if (r.metaKey || r.ctrlKey)
|
|
229
229
|
return e.initSide();
|
|
230
|
-
|
|
230
|
+
Pe(e, "previous");
|
|
231
231
|
}
|
|
232
232
|
},
|
|
233
233
|
ArrowDown: (r) => {
|
|
234
|
-
r.altKey ? e.moveDownNode() :
|
|
234
|
+
r.altKey ? e.moveDownNode() : Pe(e, "next");
|
|
235
235
|
},
|
|
236
236
|
ArrowLeft: (r) => {
|
|
237
237
|
if (r.metaKey || r.ctrlKey)
|
|
238
238
|
return e.initLeft();
|
|
239
|
-
|
|
239
|
+
De(e, D.LHS);
|
|
240
240
|
},
|
|
241
241
|
ArrowRight: (r) => {
|
|
242
242
|
if (r.metaKey || r.ctrlKey)
|
|
243
243
|
return e.initRight();
|
|
244
|
-
|
|
244
|
+
De(e, D.RHS);
|
|
245
245
|
},
|
|
246
246
|
PageUp: () => e.moveUpNode(),
|
|
247
247
|
PageDown: () => {
|
|
@@ -257,10 +257,10 @@ function yt(e, t) {
|
|
|
257
257
|
!e.waitCopy || !e.currentNode || (r.metaKey || r.ctrlKey) && (e.waitCopy.length === 1 ? e.copyNode(e.waitCopy[0], e.currentNode) : e.copyNodes(e.waitCopy, e.currentNode));
|
|
258
258
|
},
|
|
259
259
|
"=": (r) => {
|
|
260
|
-
(r.metaKey || r.ctrlKey) &&
|
|
260
|
+
(r.metaKey || r.ctrlKey) && re(e, "in");
|
|
261
261
|
},
|
|
262
262
|
"-": (r) => {
|
|
263
|
-
(r.metaKey || r.ctrlKey) &&
|
|
263
|
+
(r.metaKey || r.ctrlKey) && re(e, "out");
|
|
264
264
|
},
|
|
265
265
|
0: (r) => {
|
|
266
266
|
if (r.metaKey || r.ctrlKey) {
|
|
@@ -284,7 +284,7 @@ function yt(e, t) {
|
|
|
284
284
|
c && c(r);
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function bt(e) {
|
|
288
288
|
const { dragMoveHelper: t } = e;
|
|
289
289
|
let n = 0;
|
|
290
290
|
e.spacePressed = !1;
|
|
@@ -302,119 +302,122 @@ function vt(e) {
|
|
|
302
302
|
t.clear();
|
|
303
303
|
return;
|
|
304
304
|
}
|
|
305
|
-
const
|
|
306
|
-
if (
|
|
307
|
-
d.ctrlKey || d.metaKey ? e.expandNodeAll(
|
|
308
|
-
else if (
|
|
309
|
-
e.selectNode(
|
|
305
|
+
const f = d.target;
|
|
306
|
+
if (f.tagName === "ME-EPD")
|
|
307
|
+
d.ctrlKey || d.metaKey ? e.expandNodeAll(f.previousSibling) : e.expandNode(f.previousSibling);
|
|
308
|
+
else if (f.tagName === "ME-TPC" && e.currentNodes.length > 1)
|
|
309
|
+
e.selectNode(f);
|
|
310
310
|
else if (!e.editable)
|
|
311
311
|
return;
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
312
|
+
const y = f.closest(".svg-label");
|
|
313
|
+
if (y) {
|
|
314
|
+
const E = y.dataset.svgId, x = y.dataset.type, b = document.getElementById(E);
|
|
315
|
+
if (b) {
|
|
316
|
+
if (x === "arrow") {
|
|
317
|
+
e.selectArrow(b);
|
|
317
318
|
return;
|
|
318
|
-
} else if (
|
|
319
|
-
e.selectSummary(
|
|
319
|
+
} else if (x === "summary") {
|
|
320
|
+
e.selectSummary(b);
|
|
320
321
|
return;
|
|
321
322
|
}
|
|
322
323
|
}
|
|
323
324
|
}
|
|
324
|
-
if (
|
|
325
|
-
const
|
|
326
|
-
if (
|
|
327
|
-
e.selectArrow(
|
|
325
|
+
if (f.closest(".topiclinks")) {
|
|
326
|
+
const E = f.closest("g");
|
|
327
|
+
if (E) {
|
|
328
|
+
e.selectArrow(E);
|
|
328
329
|
return;
|
|
329
330
|
}
|
|
330
331
|
}
|
|
331
|
-
if (
|
|
332
|
-
const
|
|
333
|
-
if (
|
|
334
|
-
e.selectSummary(
|
|
332
|
+
if (f.closest(".summary")) {
|
|
333
|
+
const E = f.closest("g");
|
|
334
|
+
if (E) {
|
|
335
|
+
e.selectSummary(E);
|
|
335
336
|
return;
|
|
336
337
|
}
|
|
337
338
|
}
|
|
338
339
|
}, s = (d) => {
|
|
339
340
|
if (!e.editable) return;
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
341
|
+
const f = d.target;
|
|
342
|
+
pe(f) && e.beginEdit(f);
|
|
343
|
+
const y = f.closest(".svg-label");
|
|
344
|
+
if (y) {
|
|
345
|
+
const E = y.dataset.svgId, x = y.dataset.type, b = document.getElementById(E);
|
|
346
|
+
if (b) {
|
|
347
|
+
if (x === "arrow") {
|
|
348
|
+
e.editArrowLabel(b);
|
|
346
349
|
return;
|
|
347
|
-
} else if (
|
|
348
|
-
e.editSummary(
|
|
350
|
+
} else if (x === "summary") {
|
|
351
|
+
e.editSummary(b);
|
|
349
352
|
return;
|
|
350
353
|
}
|
|
351
354
|
}
|
|
352
355
|
}
|
|
353
|
-
if (
|
|
354
|
-
const
|
|
355
|
-
if (
|
|
356
|
-
e.editArrowLabel(
|
|
356
|
+
if (f.closest(".topiclinks")) {
|
|
357
|
+
const E = f.closest("g");
|
|
358
|
+
if (E) {
|
|
359
|
+
e.editArrowLabel(E);
|
|
357
360
|
return;
|
|
358
361
|
}
|
|
359
362
|
}
|
|
360
|
-
if (
|
|
361
|
-
const
|
|
362
|
-
if (
|
|
363
|
-
e.editSummary(
|
|
363
|
+
if (f.closest(".summary")) {
|
|
364
|
+
const E = f.closest("g");
|
|
365
|
+
if (E) {
|
|
366
|
+
e.editSummary(E);
|
|
364
367
|
return;
|
|
365
368
|
}
|
|
366
369
|
}
|
|
367
370
|
}, i = (d) => {
|
|
368
371
|
if (d.pointerType === "mouse") return;
|
|
369
|
-
const
|
|
370
|
-
|
|
372
|
+
const f = (/* @__PURE__ */ new Date()).getTime(), y = f - n;
|
|
373
|
+
y < 300 && y > 0 && s(d), n = f;
|
|
371
374
|
}, l = (d) => {
|
|
372
375
|
d.code === "Space" && (e.spacePressed = !0, e.container.classList.add("space-pressed"));
|
|
373
376
|
}, r = (d) => {
|
|
374
377
|
d.code === "Space" && (e.spacePressed = !1, e.container.classList.remove("space-pressed"));
|
|
375
378
|
}, c = (d) => {
|
|
376
379
|
t.moved = !1;
|
|
377
|
-
const
|
|
378
|
-
if (!
|
|
380
|
+
const f = e.spacePressed && d.button === 0 && d.pointerType === "mouse", y = e.mouseSelectionButton === 0 ? 2 : 0, w = d.button === y && d.pointerType === "mouse" || d.pointerType === "touch";
|
|
381
|
+
if (!f && !w) return;
|
|
379
382
|
t.x = d.clientX, t.y = d.clientY;
|
|
380
|
-
const
|
|
381
|
-
(
|
|
383
|
+
const S = d.target;
|
|
384
|
+
(f || S.className !== "circle" && S.contentEditable !== "plaintext-only") && (t.mousedown = !0, S.setPointerCapture(d.pointerId));
|
|
382
385
|
}, a = (d) => {
|
|
383
386
|
if (d.target.contentEditable !== "plaintext-only" || e.spacePressed && t.mousedown) {
|
|
384
|
-
const
|
|
385
|
-
t.onMove(
|
|
387
|
+
const f = d.clientX - t.x, y = d.clientY - t.y;
|
|
388
|
+
t.onMove(f, y);
|
|
386
389
|
}
|
|
387
390
|
t.x = d.clientX, t.y = d.clientY;
|
|
388
|
-
},
|
|
391
|
+
}, h = (d) => {
|
|
389
392
|
if (!t.mousedown) return;
|
|
390
|
-
const
|
|
391
|
-
|
|
393
|
+
const f = d.target;
|
|
394
|
+
f.hasPointerCapture && f.hasPointerCapture(d.pointerId) && f.releasePointerCapture(d.pointerId), t.clear();
|
|
392
395
|
}, u = () => {
|
|
393
396
|
t.mousedown && t.clear();
|
|
394
397
|
}, g = (d) => {
|
|
395
398
|
if (d.preventDefault(), d.button !== 2 || !e.editable) return;
|
|
396
|
-
const
|
|
397
|
-
|
|
399
|
+
const f = d.target;
|
|
400
|
+
pe(f) && !f.classList.contains("selected") && e.selectNode(f), setTimeout(() => {
|
|
398
401
|
e.dragMoveHelper.moved || e.bus.fire("showContextMenu", d);
|
|
399
402
|
}, 200);
|
|
400
|
-
},
|
|
401
|
-
d.stopPropagation(), d.preventDefault(), d.ctrlKey || d.metaKey ? d.deltaY < 0 ?
|
|
403
|
+
}, v = (d) => {
|
|
404
|
+
d.stopPropagation(), d.preventDefault(), d.ctrlKey || d.metaKey ? d.deltaY < 0 ? re(e, "in", e.dragMoveHelper) : e.scaleVal - e.scaleSensitivity > 0 && re(e, "out", e.dragMoveHelper) : d.shiftKey ? e.move(-d.deltaY, 0) : e.move(-d.deltaX, -d.deltaY);
|
|
402
405
|
}, { container: m } = e;
|
|
403
|
-
return
|
|
406
|
+
return Ce([
|
|
404
407
|
{ dom: m, evt: "pointerdown", func: c },
|
|
405
408
|
{ dom: m, evt: "pointermove", func: a },
|
|
406
|
-
{ dom: m, evt: "pointerup", func:
|
|
409
|
+
{ dom: m, evt: "pointerup", func: h },
|
|
407
410
|
{ dom: m, evt: "pointerup", func: i },
|
|
408
411
|
{ dom: m, evt: "click", func: o },
|
|
409
412
|
{ dom: m, evt: "dblclick", func: s },
|
|
410
413
|
{ dom: m, evt: "contextmenu", func: g },
|
|
411
|
-
{ dom: m, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel :
|
|
414
|
+
{ dom: m, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : v },
|
|
412
415
|
{ dom: m, evt: "blur", func: u },
|
|
413
416
|
{ dom: m, evt: "keydown", func: l },
|
|
414
417
|
{ dom: m, evt: "keyup", func: r }
|
|
415
418
|
]);
|
|
416
419
|
}
|
|
417
|
-
function
|
|
420
|
+
function wt() {
|
|
418
421
|
return {
|
|
419
422
|
handlers: {},
|
|
420
423
|
addListener: function(e, t) {
|
|
@@ -438,11 +441,11 @@ function bt() {
|
|
|
438
441
|
}
|
|
439
442
|
};
|
|
440
443
|
}
|
|
441
|
-
const
|
|
444
|
+
const le = document, xt = function() {
|
|
442
445
|
this.nodes.innerHTML = "";
|
|
443
446
|
const e = this.createTopic(this.nodeData);
|
|
444
|
-
|
|
445
|
-
const t =
|
|
447
|
+
Se.call(this, e, this.nodeData), e.draggable = !1;
|
|
448
|
+
const t = le.createElement("me-root");
|
|
446
449
|
t.appendChild(e);
|
|
447
450
|
const n = this.nodeData.children || [];
|
|
448
451
|
if (this.direction === 2) {
|
|
@@ -451,29 +454,29 @@ const re = document, wt = function() {
|
|
|
451
454
|
i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
|
|
452
455
|
});
|
|
453
456
|
}
|
|
454
|
-
|
|
455
|
-
},
|
|
456
|
-
const o =
|
|
457
|
-
o.className =
|
|
458
|
-
const s =
|
|
459
|
-
s.className =
|
|
457
|
+
Et(this, n, t);
|
|
458
|
+
}, Et = function(e, t, n) {
|
|
459
|
+
const o = le.createElement("me-main");
|
|
460
|
+
o.className = D.LHS;
|
|
461
|
+
const s = le.createElement("me-main");
|
|
462
|
+
s.className = D.RHS;
|
|
460
463
|
for (let i = 0; i < t.length; i++) {
|
|
461
464
|
const l = t[i], { grp: r } = e.createWrapper(l);
|
|
462
465
|
e.direction === 2 ? l.direction === 0 ? o.appendChild(r) : s.appendChild(r) : e.direction === 0 ? o.appendChild(r) : s.appendChild(r);
|
|
463
466
|
}
|
|
464
467
|
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines), e.nodes.appendChild(e.labelContainer);
|
|
465
|
-
},
|
|
466
|
-
const n =
|
|
468
|
+
}, Ct = function(e, t) {
|
|
469
|
+
const n = le.createElement("me-children");
|
|
467
470
|
for (let o = 0; o < t.length; o++) {
|
|
468
471
|
const s = t[o], { grp: i } = e.createWrapper(s);
|
|
469
472
|
n.appendChild(i);
|
|
470
473
|
}
|
|
471
474
|
return n;
|
|
472
|
-
}, _ = document,
|
|
475
|
+
}, _ = document, Ue = function(e, t) {
|
|
473
476
|
const o = (this?.el ? this.el : t || document).querySelector(`[data-nodeid="me${e}"]`);
|
|
474
477
|
if (!o) throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
475
478
|
return o;
|
|
476
|
-
},
|
|
479
|
+
}, Se = function(e, t) {
|
|
477
480
|
if (e.innerHTML = "", t.style) {
|
|
478
481
|
const n = t.style;
|
|
479
482
|
for (const o in n)
|
|
@@ -500,7 +503,7 @@ const re = document, wt = function() {
|
|
|
500
503
|
} else e.link && (e.link = void 0);
|
|
501
504
|
if (t.icons && t.icons.length) {
|
|
502
505
|
const n = _.createElement("span");
|
|
503
|
-
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${
|
|
506
|
+
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${ue(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
|
|
504
507
|
} else e.icons && (e.icons = void 0);
|
|
505
508
|
if (t.tags && t.tags.length) {
|
|
506
509
|
const n = _.createElement("div");
|
|
@@ -509,35 +512,35 @@ const re = document, wt = function() {
|
|
|
509
512
|
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);
|
|
510
513
|
}), e.appendChild(n), e.tags = n;
|
|
511
514
|
} else e.tags && (e.tags = void 0);
|
|
512
|
-
},
|
|
515
|
+
}, St = function(e, t) {
|
|
513
516
|
const n = _.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
|
|
514
517
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
515
|
-
const i =
|
|
518
|
+
const i = Ne(e.expanded);
|
|
516
519
|
if (o.appendChild(i), e.expanded !== !1) {
|
|
517
|
-
const l =
|
|
520
|
+
const l = Ct(this, e.children);
|
|
518
521
|
n.appendChild(l);
|
|
519
522
|
}
|
|
520
523
|
}
|
|
521
524
|
return { grp: n, top: o, tpc: s };
|
|
522
|
-
}, St = function(e) {
|
|
523
|
-
const t = _.createElement("me-parent"), n = this.createTopic(e);
|
|
524
|
-
return Ce.call(this, n, e), t.appendChild(n), { p: t, tpc: n };
|
|
525
525
|
}, Nt = function(e) {
|
|
526
|
+
const t = _.createElement("me-parent"), n = this.createTopic(e);
|
|
527
|
+
return Se.call(this, n, e), t.appendChild(n), { p: t, tpc: n };
|
|
528
|
+
}, kt = function(e) {
|
|
526
529
|
const t = _.createElement("me-children");
|
|
527
530
|
return t.append(...e), t;
|
|
528
|
-
},
|
|
531
|
+
}, _t = function(e) {
|
|
529
532
|
const t = _.createElement("me-tpc");
|
|
530
533
|
return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t.draggable = this.draggable, t;
|
|
531
534
|
};
|
|
532
|
-
function
|
|
535
|
+
function Je(e) {
|
|
533
536
|
const t = _.createRange();
|
|
534
537
|
t.selectNodeContents(e);
|
|
535
538
|
const n = window.getSelection();
|
|
536
539
|
n && (n.removeAllRanges(), n.addRange(t));
|
|
537
540
|
}
|
|
538
|
-
const
|
|
541
|
+
const Tt = function(e) {
|
|
539
542
|
if (!e) return;
|
|
540
|
-
const t = _.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } =
|
|
543
|
+
const t = _.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = $(this.nodes, e);
|
|
541
544
|
this.nodes.appendChild(t), t.id = "input-box", t.textContent = o, t.contentEditable = "plaintext-only", t.spellcheck = !1;
|
|
542
545
|
const l = getComputedStyle(e);
|
|
543
546
|
t.style.cssText = `
|
|
@@ -550,7 +553,7 @@ const _t = function(e) {
|
|
|
550
553
|
margin:${l.margin};
|
|
551
554
|
background-color:${l.backgroundColor !== "rgba(0, 0, 0, 0)" && l.backgroundColor};
|
|
552
555
|
border: ${l.border};
|
|
553
|
-
border-radius:${l.borderRadius}; `, this.direction === 0 && (t.style.right = "0"),
|
|
556
|
+
border-radius:${l.borderRadius}; `, this.direction === 0 && (t.style.right = "0"), Je(t), this.bus.fire("operation", {
|
|
554
557
|
name: "beginEdit",
|
|
555
558
|
obj: e.nodeObj
|
|
556
559
|
}), t.addEventListener("keydown", (r) => {
|
|
@@ -570,34 +573,34 @@ const _t = function(e) {
|
|
|
570
573
|
origin: o
|
|
571
574
|
}));
|
|
572
575
|
});
|
|
573
|
-
},
|
|
576
|
+
}, Ne = function(e) {
|
|
574
577
|
const t = _.createElement("me-epd");
|
|
575
578
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
576
|
-
}, q = document,
|
|
579
|
+
}, q = document, M = "http://www.w3.org/2000/svg", de = function(e) {
|
|
577
580
|
const t = e.clientWidth, n = e.clientHeight, o = e.dataset, s = Number(o.x), i = Number(o.y), l = o.anchor;
|
|
578
581
|
let r = s;
|
|
579
582
|
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";
|
|
580
|
-
},
|
|
583
|
+
}, ge = function(e, t, n, o) {
|
|
581
584
|
const { anchor: s = "middle", color: i, dataType: l, svgId: r } = o, c = document.createElement("div");
|
|
582
585
|
c.className = "svg-label", c.style.color = i || "#666";
|
|
583
586
|
const a = "label-" + r;
|
|
584
587
|
return c.id = a, 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;
|
|
585
|
-
},
|
|
586
|
-
const o = q.createElementNS(
|
|
588
|
+
}, Ze = function(e, t, n) {
|
|
589
|
+
const o = q.createElementNS(M, "path");
|
|
587
590
|
return k(o, {
|
|
588
591
|
d: e,
|
|
589
592
|
stroke: t || "#666",
|
|
590
593
|
fill: "none",
|
|
591
594
|
"stroke-width": n
|
|
592
595
|
}), o;
|
|
593
|
-
},
|
|
594
|
-
const t = q.createElementNS(
|
|
596
|
+
}, U = function(e) {
|
|
597
|
+
const t = q.createElementNS(M, "svg");
|
|
595
598
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
596
|
-
},
|
|
597
|
-
const e = q.createElementNS(
|
|
599
|
+
}, $e = function() {
|
|
600
|
+
const e = q.createElementNS(M, "line");
|
|
598
601
|
return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
|
|
599
|
-
},
|
|
600
|
-
const s = q.createElementNS(
|
|
602
|
+
}, Lt = function(e, t, n, o) {
|
|
603
|
+
const s = q.createElementNS(M, "g");
|
|
601
604
|
return [
|
|
602
605
|
{
|
|
603
606
|
name: "line",
|
|
@@ -612,15 +615,15 @@ const _t = function(e) {
|
|
|
612
615
|
d: n
|
|
613
616
|
}
|
|
614
617
|
].forEach((l, r) => {
|
|
615
|
-
const c = l.d, a = q.createElementNS(
|
|
618
|
+
const c = l.d, a = q.createElementNS(M, "path"), h = {
|
|
616
619
|
d: c,
|
|
617
620
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
618
621
|
fill: "none",
|
|
619
622
|
"stroke-linecap": o?.strokeLinecap || "cap",
|
|
620
623
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
621
624
|
};
|
|
622
|
-
o?.opacity !== void 0 && (
|
|
623
|
-
const u = q.createElementNS(
|
|
625
|
+
o?.opacity !== void 0 && (h.opacity = String(o.opacity)), k(a, h), r === 0 && a.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
626
|
+
const u = q.createElementNS(M, "path");
|
|
624
627
|
k(u, {
|
|
625
628
|
d: c,
|
|
626
629
|
stroke: "transparent",
|
|
@@ -628,14 +631,14 @@ const _t = function(e) {
|
|
|
628
631
|
"stroke-width": "15"
|
|
629
632
|
}), s.appendChild(u), s.appendChild(a), s[l.name] = a;
|
|
630
633
|
}), s;
|
|
631
|
-
},
|
|
634
|
+
}, Qe = function(e, t, n) {
|
|
632
635
|
if (!t) return;
|
|
633
636
|
const o = n.label, s = t.cloneNode(!0);
|
|
634
637
|
e.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
|
|
635
638
|
left:${t.style.left};
|
|
636
639
|
top:${t.style.top};
|
|
637
640
|
max-width: 200px;
|
|
638
|
-
`,
|
|
641
|
+
`, Je(s), e.scrollIntoView(s), s.addEventListener("keydown", (i) => {
|
|
639
642
|
i.stopPropagation();
|
|
640
643
|
const l = i.key;
|
|
641
644
|
if (l === "Enter" || l === "Tab") {
|
|
@@ -645,7 +648,7 @@ const _t = function(e) {
|
|
|
645
648
|
}), s.addEventListener("blur", () => {
|
|
646
649
|
if (!s) return;
|
|
647
650
|
const i = s.textContent?.trim() || "";
|
|
648
|
-
i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (t.textContent = n.label,
|
|
651
|
+
i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (e.markdown ? t.innerHTML = e.markdown(n.label, n) : t.textContent = n.label, de(t), "parent" in n ? e.bus.fire("operation", {
|
|
649
652
|
name: "finishEditSummary",
|
|
650
653
|
obj: n
|
|
651
654
|
}) : e.bus.fire("operation", {
|
|
@@ -653,32 +656,32 @@ const _t = function(e) {
|
|
|
653
656
|
obj: n
|
|
654
657
|
}));
|
|
655
658
|
});
|
|
656
|
-
},
|
|
659
|
+
}, At = function(e) {
|
|
657
660
|
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");
|
|
658
661
|
this.lines.innerHTML = "";
|
|
659
662
|
for (let r = 0; r < l.length; r++) {
|
|
660
|
-
const c = l[r], a = c.querySelector("me-tpc"), { offsetLeft:
|
|
661
|
-
if (a.style.borderColor =
|
|
663
|
+
const c = l[r], a = c.querySelector("me-tpc"), { offsetLeft: h, offsetTop: u } = $(this.nodes, a), g = a.offsetWidth, v = a.offsetHeight, m = c.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: u, cL: h, cW: g, cH: v, direction: m, containerHeight: this.nodes.offsetHeight }), d = this.theme.palette, f = a.nodeObj.branchColor || d[r % d.length];
|
|
664
|
+
if (a.style.borderColor = f, this.lines.appendChild(Ze(p, f, "3")), e && e !== c)
|
|
662
665
|
continue;
|
|
663
|
-
const
|
|
664
|
-
|
|
666
|
+
const y = U("subLines"), w = c.lastChild;
|
|
667
|
+
w.tagName === "svg" && w.remove(), c.appendChild(y), et(this, y, f, c, m, !0);
|
|
665
668
|
}
|
|
666
669
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
667
|
-
},
|
|
670
|
+
}, et = function(e, t, n, o, s, i) {
|
|
668
671
|
const l = o.firstChild, r = o.children[1].children;
|
|
669
672
|
if (r.length === 0) return;
|
|
670
|
-
const c = l.offsetTop, a = l.offsetLeft,
|
|
673
|
+
const c = l.offsetTop, a = l.offsetLeft, h = l.offsetWidth, u = l.offsetHeight;
|
|
671
674
|
for (let g = 0; g < r.length; g++) {
|
|
672
|
-
const
|
|
673
|
-
t.appendChild(
|
|
674
|
-
const
|
|
675
|
-
if (
|
|
676
|
-
if (!
|
|
675
|
+
const v = r[g], m = v.firstChild, p = m.offsetTop, d = m.offsetLeft, f = m.offsetWidth, y = m.offsetHeight, w = m.firstChild.nodeObj.branchColor || n, S = e.generateSubBranch({ pT: c, pL: a, pW: h, pH: u, cT: p, cL: d, cW: f, cH: y, direction: s, isFirst: i });
|
|
676
|
+
t.appendChild(Ze(S, w, "2"));
|
|
677
|
+
const E = m.children[1];
|
|
678
|
+
if (E) {
|
|
679
|
+
if (!E.expanded) continue;
|
|
677
680
|
} else
|
|
678
681
|
continue;
|
|
679
|
-
|
|
682
|
+
et(e, t, w, v, s);
|
|
680
683
|
}
|
|
681
|
-
},
|
|
684
|
+
}, Oe = {
|
|
682
685
|
addChild: "插入子节点",
|
|
683
686
|
addParent: "插入父节点",
|
|
684
687
|
addSibling: "插入同级节点",
|
|
@@ -691,9 +694,9 @@ const _t = function(e) {
|
|
|
691
694
|
linkBidirectional: "双向连接",
|
|
692
695
|
clickTips: "请点击目标节点",
|
|
693
696
|
summary: "摘要"
|
|
694
|
-
},
|
|
695
|
-
cn:
|
|
696
|
-
zh_CN:
|
|
697
|
+
}, je = {
|
|
698
|
+
cn: Oe,
|
|
699
|
+
zh_CN: Oe,
|
|
697
700
|
zh_TW: {
|
|
698
701
|
addChild: "插入子節點",
|
|
699
702
|
addParent: "插入父節點",
|
|
@@ -821,98 +824,98 @@ const _t = function(e) {
|
|
|
821
824
|
summary: "요약"
|
|
822
825
|
}
|
|
823
826
|
};
|
|
824
|
-
function
|
|
827
|
+
function Mt(e, t) {
|
|
825
828
|
t = t === !0 ? {
|
|
826
829
|
focus: !0,
|
|
827
830
|
link: !0
|
|
828
831
|
} : t;
|
|
829
|
-
const n = (
|
|
830
|
-
const
|
|
831
|
-
return
|
|
832
|
-
}, o = (
|
|
832
|
+
const n = (x) => {
|
|
833
|
+
const b = document.createElement("div");
|
|
834
|
+
return b.innerText = x, b.className = "tips", b;
|
|
835
|
+
}, o = (x, b, C) => {
|
|
833
836
|
const N = document.createElement("li");
|
|
834
|
-
return N.id =
|
|
835
|
-
}, s =
|
|
836
|
-
if (
|
|
837
|
-
for (let
|
|
838
|
-
const
|
|
839
|
-
|
|
840
|
-
|
|
837
|
+
return N.id = x, N.innerHTML = `<span>${ue(b)}</span><span ${C ? 'class="key"' : ""}>${ue(C)}</span>`, N;
|
|
838
|
+
}, s = je[e.locale] ? e.locale : "en", i = je[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"), a = o("cm-remove_child", i.removeNode, "Delete"), h = o("cm-fucus", i.focus, ""), u = o("cm-unfucus", i.cancelFocus, ""), g = o("cm-up", i.moveUp, "PgUp"), v = o("cm-down", i.moveDown, "Pgdn"), m = o("cm-link", i.link, ""), p = o("cm-link-bidirectional", i.linkBidirectional, ""), d = o("cm-summary", i.summary, ""), f = document.createElement("ul");
|
|
839
|
+
if (f.className = "menu-list", f.appendChild(l), f.appendChild(r), f.appendChild(c), f.appendChild(a), t.focus && (f.appendChild(h), f.appendChild(u)), f.appendChild(g), f.appendChild(v), f.appendChild(d), t.link && (f.appendChild(m), f.appendChild(p)), t && t.extend)
|
|
840
|
+
for (let x = 0; x < t.extend.length; x++) {
|
|
841
|
+
const b = t.extend[x], C = o(b.name, b.name, b.key || "");
|
|
842
|
+
f.appendChild(C), C.onclick = (N) => {
|
|
843
|
+
b.onclick(N);
|
|
841
844
|
};
|
|
842
845
|
}
|
|
843
|
-
const
|
|
844
|
-
|
|
845
|
-
let
|
|
846
|
-
const
|
|
847
|
-
const
|
|
848
|
-
if (
|
|
849
|
-
|
|
850
|
-
const C =
|
|
851
|
-
N +
|
|
846
|
+
const y = document.createElement("div");
|
|
847
|
+
y.className = "context-menu", y.appendChild(f), y.hidden = !0, e.container.append(y);
|
|
848
|
+
let w = !0;
|
|
849
|
+
const S = (x) => {
|
|
850
|
+
const b = x.target;
|
|
851
|
+
if (pe(b)) {
|
|
852
|
+
b.parentElement.tagName === "ME-ROOT" ? w = !0 : w = !1, w ? (h.className = "disabled", g.className = "disabled", v.className = "disabled", r.className = "disabled", c.className = "disabled", a.className = "disabled") : (h.className = "", g.className = "", v.className = "", r.className = "", c.className = "", a.className = ""), y.hidden = !1, f.style.top = "", f.style.bottom = "", f.style.left = "", f.style.right = "";
|
|
853
|
+
const C = f.getBoundingClientRect(), N = f.offsetHeight, L = f.offsetWidth, O = x.clientY - C.top, j = x.clientX - C.left;
|
|
854
|
+
N + O > window.innerHeight ? (f.style.top = "", f.style.bottom = "0px") : (f.style.bottom = "", f.style.top = O + 15 + "px"), L + j > window.innerWidth ? (f.style.left = "", f.style.right = "0px") : (f.style.right = "", f.style.left = j + 10 + "px");
|
|
852
855
|
}
|
|
853
856
|
};
|
|
854
|
-
e.bus.addListener("showContextMenu",
|
|
855
|
-
|
|
857
|
+
e.bus.addListener("showContextMenu", S), y.onclick = (x) => {
|
|
858
|
+
x.target === y && (y.hidden = !0);
|
|
856
859
|
}, l.onclick = () => {
|
|
857
|
-
e.addChild(),
|
|
860
|
+
e.addChild(), y.hidden = !0;
|
|
858
861
|
}, r.onclick = () => {
|
|
859
|
-
e.insertParent(),
|
|
862
|
+
e.insertParent(), y.hidden = !0;
|
|
860
863
|
}, c.onclick = () => {
|
|
861
|
-
|
|
864
|
+
w || (e.insertSibling("after"), y.hidden = !0);
|
|
862
865
|
}, a.onclick = () => {
|
|
863
|
-
|
|
864
|
-
},
|
|
865
|
-
|
|
866
|
+
w || (e.removeNodes(e.currentNodes || []), y.hidden = !0);
|
|
867
|
+
}, h.onclick = () => {
|
|
868
|
+
w || (e.focusNode(e.currentNode), y.hidden = !0);
|
|
866
869
|
}, u.onclick = () => {
|
|
867
|
-
e.cancelFocus(),
|
|
870
|
+
e.cancelFocus(), y.hidden = !0;
|
|
868
871
|
}, g.onclick = () => {
|
|
869
|
-
|
|
870
|
-
},
|
|
871
|
-
|
|
872
|
+
w || (e.moveUpNode(), y.hidden = !0);
|
|
873
|
+
}, v.onclick = () => {
|
|
874
|
+
w || (e.moveDownNode(), y.hidden = !0);
|
|
872
875
|
};
|
|
873
|
-
const
|
|
874
|
-
|
|
875
|
-
const
|
|
876
|
+
const E = (x) => {
|
|
877
|
+
y.hidden = !0;
|
|
878
|
+
const b = e.currentNode, C = n(i.clickTips);
|
|
876
879
|
e.container.appendChild(C), e.map.addEventListener(
|
|
877
880
|
"click",
|
|
878
881
|
(N) => {
|
|
879
882
|
N.preventDefault(), C.remove();
|
|
880
883
|
const L = N.target;
|
|
881
|
-
(L.parentElement.tagName === "ME-PARENT" || L.parentElement.tagName === "ME-ROOT") && e.createArrow(
|
|
884
|
+
(L.parentElement.tagName === "ME-PARENT" || L.parentElement.tagName === "ME-ROOT") && e.createArrow(b, L, x);
|
|
882
885
|
},
|
|
883
886
|
{
|
|
884
887
|
once: !0
|
|
885
888
|
}
|
|
886
889
|
);
|
|
887
890
|
};
|
|
888
|
-
return m.onclick = () =>
|
|
889
|
-
|
|
891
|
+
return m.onclick = () => E(), p.onclick = () => E({ bidirectional: !0 }), d.onclick = () => {
|
|
892
|
+
y.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
|
|
890
893
|
}, () => {
|
|
891
|
-
l.onclick = null, r.onclick = null, c.onclick = null, a.onclick = null,
|
|
894
|
+
l.onclick = null, r.onclick = null, c.onclick = null, a.onclick = null, h.onclick = null, u.onclick = null, g.onclick = null, v.onclick = null, m.onclick = null, d.onclick = null, y.onclick = null, e.container.oncontextmenu = null;
|
|
892
895
|
};
|
|
893
896
|
}
|
|
894
|
-
const
|
|
897
|
+
const me = document, Dt = function(e, t) {
|
|
895
898
|
if (!t)
|
|
896
|
-
return
|
|
899
|
+
return ye(e), e;
|
|
897
900
|
let n = e.querySelector(".insert-preview");
|
|
898
901
|
const o = `insert-preview ${t} show`;
|
|
899
|
-
return n || (n =
|
|
900
|
-
},
|
|
902
|
+
return n || (n = me.createElement("div"), e.appendChild(n)), n.className = o, e;
|
|
903
|
+
}, ye = function(e) {
|
|
901
904
|
if (!e) return;
|
|
902
905
|
const t = e.querySelectorAll(".insert-preview");
|
|
903
906
|
for (const n of t || [])
|
|
904
907
|
n.remove();
|
|
905
|
-
},
|
|
908
|
+
}, He = function(e, t) {
|
|
906
909
|
for (const n of t) {
|
|
907
910
|
const o = n.parentElement.parentElement.contains(e);
|
|
908
911
|
if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent)) return !1;
|
|
909
912
|
}
|
|
910
913
|
return !0;
|
|
911
|
-
},
|
|
914
|
+
}, Pt = function(e) {
|
|
912
915
|
const t = document.createElement("div");
|
|
913
916
|
return t.className = "mind-elixir-ghost", e.container.appendChild(t), t;
|
|
914
917
|
};
|
|
915
|
-
class
|
|
918
|
+
class $t {
|
|
916
919
|
mind;
|
|
917
920
|
isMoving = !1;
|
|
918
921
|
interval = null;
|
|
@@ -929,61 +932,61 @@ class Pt {
|
|
|
929
932
|
this.isMoving = !1, clearInterval(this.interval);
|
|
930
933
|
}
|
|
931
934
|
}
|
|
932
|
-
function
|
|
935
|
+
function Ot(e) {
|
|
933
936
|
let t = null, n = null;
|
|
934
|
-
const o =
|
|
937
|
+
const o = Pt(e), s = new $t(e), i = (a) => {
|
|
935
938
|
if (e.spacePressed) {
|
|
936
939
|
a.preventDefault();
|
|
937
940
|
return;
|
|
938
941
|
}
|
|
939
942
|
e.selection.cancel();
|
|
940
|
-
const
|
|
941
|
-
if (
|
|
943
|
+
const h = a.target;
|
|
944
|
+
if (h?.tagName !== "ME-TPC") {
|
|
942
945
|
a.preventDefault();
|
|
943
946
|
return;
|
|
944
947
|
}
|
|
945
948
|
let u = e.currentNodes;
|
|
946
|
-
u?.includes(
|
|
949
|
+
u?.includes(h) || (e.selectNode(h), u = e.currentNodes), e.dragged = u, u.length > 1 ? o.innerHTML = u.length + "" : o.innerHTML = h.innerHTML;
|
|
947
950
|
for (const g of u)
|
|
948
951
|
g.parentElement.parentElement.style.opacity = "0.5";
|
|
949
952
|
a.dataTransfer.setDragImage(o, 0, 0), a.dataTransfer.dropEffect = "move", e.dragMoveHelper.clear();
|
|
950
953
|
}, l = (a) => {
|
|
951
|
-
const { dragged:
|
|
952
|
-
if (!
|
|
954
|
+
const { dragged: h } = e;
|
|
955
|
+
if (!h) return;
|
|
953
956
|
s.stop();
|
|
954
|
-
for (const g of
|
|
957
|
+
for (const g of h)
|
|
955
958
|
g.parentElement.parentElement.style.opacity = "1";
|
|
956
959
|
const u = a.target;
|
|
957
|
-
u.style.opacity = "", n && (
|
|
960
|
+
u.style.opacity = "", n && (ye(n), t === "before" ? e.moveNodeBefore(h, n) : t === "after" ? e.moveNodeAfter(h, n) : t === "in" && e.moveNodeIn(h, n), e.dragged = null, o.innerHTML = "");
|
|
958
961
|
}, r = (a) => {
|
|
959
962
|
a.preventDefault();
|
|
960
|
-
const
|
|
963
|
+
const h = 12 * e.scaleVal, { dragged: u } = e;
|
|
961
964
|
if (!u) return;
|
|
962
965
|
const g = e.container.getBoundingClientRect();
|
|
963
|
-
a.clientX < g.x + 50 ? s.move(1, 0) : a.clientX > g.x + g.width - 50 ? s.move(-1, 0) : a.clientY < g.y + 50 ? s.move(0, 1) : a.clientY > g.y + g.height - 50 ? s.move(0, -1) : s.stop(),
|
|
964
|
-
const
|
|
965
|
-
if (
|
|
966
|
-
n =
|
|
967
|
-
const m =
|
|
966
|
+
a.clientX < g.x + 50 ? s.move(1, 0) : a.clientX > g.x + g.width - 50 ? s.move(-1, 0) : a.clientY < g.y + 50 ? s.move(0, 1) : a.clientY > g.y + g.height - 50 ? s.move(0, -1) : s.stop(), ye(n);
|
|
967
|
+
const v = me.elementFromPoint(a.clientX, a.clientY - h);
|
|
968
|
+
if (He(v, u)) {
|
|
969
|
+
n = v;
|
|
970
|
+
const m = v.getBoundingClientRect(), p = m.y;
|
|
968
971
|
a.clientY > p + m.height ? t = "after" : t = "in";
|
|
969
972
|
} else {
|
|
970
|
-
const m =
|
|
971
|
-
if (
|
|
973
|
+
const m = me.elementFromPoint(a.clientX, a.clientY + h), p = m.getBoundingClientRect();
|
|
974
|
+
if (He(m, u)) {
|
|
972
975
|
n = m;
|
|
973
976
|
const d = p.y;
|
|
974
977
|
a.clientY < d ? t = "before" : t = "in";
|
|
975
978
|
} else
|
|
976
979
|
t = n = null;
|
|
977
980
|
}
|
|
978
|
-
n &&
|
|
981
|
+
n && Dt(n, t);
|
|
979
982
|
};
|
|
980
|
-
return
|
|
983
|
+
return Ce([
|
|
981
984
|
{ dom: e.map, evt: "dragstart", func: i },
|
|
982
985
|
{ dom: e.map, evt: "dragend", func: l },
|
|
983
986
|
{ dom: e.map, evt: "dragover", func: r }
|
|
984
987
|
]);
|
|
985
988
|
}
|
|
986
|
-
const
|
|
989
|
+
const jt = function(e) {
|
|
987
990
|
return ["createSummary", "removeSummary", "finishEditSummary"].includes(e.name) ? {
|
|
988
991
|
type: "summary",
|
|
989
992
|
value: e.obj.id
|
|
@@ -998,7 +1001,7 @@ const Ot = function(e) {
|
|
|
998
1001
|
value: [e.obj.id]
|
|
999
1002
|
};
|
|
1000
1003
|
};
|
|
1001
|
-
function
|
|
1004
|
+
function Ht(e) {
|
|
1002
1005
|
let t = [], n = -1, o = e.getData(), s = [];
|
|
1003
1006
|
e.undo = function() {
|
|
1004
1007
|
if (n > -1) {
|
|
@@ -1025,14 +1028,14 @@ function jt(e) {
|
|
|
1025
1028
|
const i = function(c) {
|
|
1026
1029
|
if (c.name === "beginEdit") return;
|
|
1027
1030
|
t = t.slice(0, n + 1);
|
|
1028
|
-
const a = e.getData(),
|
|
1031
|
+
const a = e.getData(), h = {
|
|
1029
1032
|
prev: o,
|
|
1030
1033
|
operation: c.name,
|
|
1031
1034
|
currentSelected: s.map((u) => u.id),
|
|
1032
|
-
currentTarget:
|
|
1035
|
+
currentTarget: jt(c),
|
|
1033
1036
|
next: a
|
|
1034
1037
|
};
|
|
1035
|
-
t.push(
|
|
1038
|
+
t.push(h), o = a, n = t.length - 1;
|
|
1036
1039
|
}, l = function(c) {
|
|
1037
1040
|
(c.metaKey || c.ctrlKey) && (c.shiftKey && c.key === "Z" || c.key === "y") ? e.redo() : (c.metaKey || c.ctrlKey) && c.key === "z" && e.undo();
|
|
1038
1041
|
}, r = function() {
|
|
@@ -1042,19 +1045,19 @@ function jt(e) {
|
|
|
1042
1045
|
e.bus.removeListener("operation", i), e.bus.removeListener("selectNodes", r), e.container.removeEventListener("keydown", l);
|
|
1043
1046
|
};
|
|
1044
1047
|
}
|
|
1045
|
-
const
|
|
1046
|
-
side:
|
|
1047
|
-
left:
|
|
1048
|
-
right:
|
|
1049
|
-
full:
|
|
1050
|
-
living:
|
|
1051
|
-
zoomin:
|
|
1052
|
-
zoomout:
|
|
1048
|
+
const Bt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="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>', Rt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="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>', It = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169667709" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3037" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M385 560.69999999L385 738.9c0 36.90000001 26.4 68.5 61.3 68.5l150.2 0c1.5 0 3-0.1 4.5-0.3 10.2 38.7 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-42 0-77.3 28.6-87.5 67.39999999-1.4-0.3-2.9-0.4-4.5-0.39999999L446.3 760.4c-6.8 0-14.3-8.9-14.3-21.49999999l0-427.00000001c0-12.7 7.40000001-21.5 14.30000001-21.5l150.19999999 0c1.5 0 3-0.2 4.5-0.4 10.2 38.8 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.4 0-49.9-40.5-90.6-90.5-90.59999999-42 0-77.3 28.6-87.5 67.39999999-1.4-0.2-2.9-0.4-4.49999999-0.4L446.3 243.3c-34.80000001 0-61.3 31.6-61.3 68.50000001L385 513.7l-79.1 0c-10.4-38.5-45.49999999-67-87.4-67-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c41.79999999 0 77.00000001-28.4 87.4-67L385 560.69999999z" fill="currentColor" p-id="3038"></path></svg>', Ft = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169402629" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2170" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639.328 416c8.032 0 16.096-3.008 22.304-9.056l202.624-197.184-0.8 143.808c-0.096 17.696 14.144 32.096 31.808 32.192 0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808l1.248-222.208c0-0.672-0.352-1.248-0.384-1.92 0.032-0.512 0.288-0.896 0.288-1.408 0.032-17.664-14.272-32-31.968-32.032L671.552 96l-0.032 0c-17.664 0-31.968 14.304-32 31.968C639.488 145.632 653.824 160 671.488 160l151.872 0.224-206.368 200.8c-12.672 12.32-12.928 32.608-0.64 45.248C622.656 412.736 630.976 416 639.328 416z" p-id="2171"></path><path d="M896.032 639.552 896.032 639.552c-17.696 0-32 14.304-32.032 31.968l-0.224 151.872-200.832-206.4c-12.32-12.64-32.576-12.96-45.248-0.64-12.672 12.352-12.928 32.608-0.64 45.248l197.184 202.624-143.808-0.8c-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808-0.096 17.696 14.144 32.096 31.808 32.192l222.24 1.248c0.064 0 0.128 0 0.192 0 0.64 0 1.12-0.32 1.76-0.352 0.512 0.032 0.896 0.288 1.408 0.288l0.032 0c17.664 0 31.968-14.304 32-31.968L928 671.584C928.032 653.952 913.728 639.584 896.032 639.552z" p-id="2172"></path><path d="M209.76 159.744l143.808 0.8c0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808 0.096-17.696-14.144-32.096-31.808-32.192L131.68 95.328c-0.064 0-0.128 0-0.192 0-0.672 0-1.248 0.352-1.888 0.384-0.448 0-0.8-0.256-1.248-0.256 0 0-0.032 0-0.032 0-17.664 0-31.968 14.304-32 31.968L96 352.448c-0.032 17.664 14.272 32 31.968 32.032 0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968l0.224-151.936 200.832 206.4c6.272 6.464 14.624 9.696 22.944 9.696 8.032 0 16.096-3.008 22.304-9.056 12.672-12.32 12.96-32.608 0.64-45.248L209.76 159.744z" p-id="2173"></path><path d="M362.368 617.056l-202.624 197.184 0.8-143.808c0.096-17.696-14.144-32.096-31.808-32.192-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808l-1.248 222.24c0 0.704 0.352 1.312 0.384 2.016 0 0.448-0.256 0.832-0.256 1.312-0.032 17.664 14.272 32 31.968 32.032L352.448 928c0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968s-14.272-32-31.968-32.032l-151.936-0.224 206.4-200.832c12.672-12.352 12.96-32.608 0.64-45.248S375.008 604.704 362.368 617.056z" p-id="2174"></path></svg>', Wt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169573443" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2883" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M514.133333 488.533333m-106.666666 0a106.666667 106.666667 0 1 0 213.333333 0 106.666667 106.666667 0 1 0-213.333333 0Z" fill="currentColor" p-id="2884"></path><path d="M512 64C264.533333 64 64 264.533333 64 512c0 236.8 183.466667 428.8 416 445.866667v-134.4c-53.333333-59.733333-200.533333-230.4-200.533333-334.933334 0-130.133333 104.533333-234.666667 234.666666-234.666666s234.666667 104.533333 234.666667 234.666666c0 61.866667-49.066667 153.6-145.066667 270.933334l-59.733333 68.266666V960C776.533333 942.933333 960 748.8 960 512c0-247.466667-200.533333-448-448-448z" fill="currentColor" p-id="2885"></path></svg>', 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="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>', 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="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>', Yt = {
|
|
1049
|
+
side: Bt,
|
|
1050
|
+
left: Rt,
|
|
1051
|
+
right: It,
|
|
1052
|
+
full: Ft,
|
|
1053
|
+
living: Wt,
|
|
1054
|
+
zoomin: Kt,
|
|
1055
|
+
zoomout: Gt
|
|
1053
1056
|
}, F = (e, t) => {
|
|
1054
1057
|
const n = document.createElement("span");
|
|
1055
|
-
return n.id = e, n.innerHTML =
|
|
1058
|
+
return n.id = e, n.innerHTML = Yt[t], n;
|
|
1056
1059
|
};
|
|
1057
|
-
function
|
|
1060
|
+
function zt(e) {
|
|
1058
1061
|
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");
|
|
1059
1062
|
return l.innerText = "100%", t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb", n.onclick = () => {
|
|
1060
1063
|
document.fullscreenElement === e.el ? document.exitFullscreen() : e.el.requestFullscreen();
|
|
@@ -1066,7 +1069,7 @@ function Yt(e) {
|
|
|
1066
1069
|
e.scale(e.scaleVal + e.scaleSensitivity);
|
|
1067
1070
|
}, t;
|
|
1068
1071
|
}
|
|
1069
|
-
function
|
|
1072
|
+
function qt(e) {
|
|
1070
1073
|
const t = document.createElement("div"), n = F("tbltl", "left"), o = F("tbltr", "right"), s = F("tblts", "side");
|
|
1071
1074
|
return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
1072
1075
|
e.initLeft();
|
|
@@ -1076,10 +1079,10 @@ function zt(e) {
|
|
|
1076
1079
|
e.initSide();
|
|
1077
1080
|
}, t;
|
|
1078
1081
|
}
|
|
1079
|
-
function
|
|
1080
|
-
e.container.append(
|
|
1082
|
+
function Vt(e) {
|
|
1083
|
+
e.container.append(zt(e)), e.container.append(qt(e));
|
|
1081
1084
|
}
|
|
1082
|
-
class
|
|
1085
|
+
class Xt {
|
|
1083
1086
|
_listeners = /* @__PURE__ */ new Map();
|
|
1084
1087
|
addEventListener(t, n) {
|
|
1085
1088
|
const o = this._listeners.get(t) ?? /* @__PURE__ */ new Set();
|
|
@@ -1102,15 +1105,15 @@ class Vt {
|
|
|
1102
1105
|
off = this.removeEventListener;
|
|
1103
1106
|
emit = this.dispatchEvent;
|
|
1104
1107
|
}
|
|
1105
|
-
const
|
|
1108
|
+
const Be = (e, t = "px") => typeof e == "number" ? e + t : e, H = ({ style: e }, t, n) => {
|
|
1106
1109
|
if (typeof t == "object")
|
|
1107
1110
|
for (const [o, s] of Object.entries(t))
|
|
1108
|
-
s !== void 0 && (e[o] =
|
|
1109
|
-
else n !== void 0 && (e[t] =
|
|
1110
|
-
},
|
|
1111
|
+
s !== void 0 && (e[o] = Be(s));
|
|
1112
|
+
else n !== void 0 && (e[t] = Be(n));
|
|
1113
|
+
}, Re = (e = 0, t = 0, n = 0, o = 0) => {
|
|
1111
1114
|
const s = { x: e, y: t, width: n, height: o, top: t, left: e, right: e + n, bottom: t + o };
|
|
1112
1115
|
return { ...s, toJSON: () => JSON.stringify(s) };
|
|
1113
|
-
},
|
|
1116
|
+
}, Ut = (e) => {
|
|
1114
1117
|
let t, n = -1, o = !1;
|
|
1115
1118
|
return {
|
|
1116
1119
|
next: (...s) => {
|
|
@@ -1122,7 +1125,7 @@ const He = (e, t = "px") => typeof e == "number" ? e + t : e, H = ({ style: e },
|
|
|
1122
1125
|
cancelAnimationFrame(n), o = !1;
|
|
1123
1126
|
}
|
|
1124
1127
|
};
|
|
1125
|
-
},
|
|
1128
|
+
}, Ie = (e, t, n = "touch") => {
|
|
1126
1129
|
switch (n) {
|
|
1127
1130
|
case "center": {
|
|
1128
1131
|
const o = t.left + t.width / 2, s = t.top + t.height / 2;
|
|
@@ -1133,16 +1136,16 @@ const He = (e, t = "px") => typeof e == "number" ? e + t : e, H = ({ style: e },
|
|
|
1133
1136
|
case "touch":
|
|
1134
1137
|
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
|
|
1135
1138
|
}
|
|
1136
|
-
},
|
|
1137
|
-
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n =
|
|
1139
|
+
}, Jt = () => matchMedia("(hover: none), (pointer: coarse)").matches, Zt = () => "safari" in window, ve = (e) => Array.isArray(e) ? e : [e], tt = (e) => (t, n, o, s = {}) => {
|
|
1140
|
+
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = ve(n), t = ve(t);
|
|
1138
1141
|
for (const i of t)
|
|
1139
1142
|
if (i)
|
|
1140
1143
|
for (const l of n)
|
|
1141
1144
|
i[e](l, o, { capture: !1, ...s });
|
|
1142
|
-
}, B =
|
|
1145
|
+
}, B = tt("addEventListener"), A = tt("removeEventListener"), ee = (e) => {
|
|
1143
1146
|
const { clientX: t, clientY: n, target: o } = e.touches?.[0] ?? e;
|
|
1144
1147
|
return { x: t, y: n, target: o };
|
|
1145
|
-
}, K = (e, t = document) =>
|
|
1148
|
+
}, K = (e, t = document) => ve(e).map((n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null).flat().filter(Boolean), Qt = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
|
|
1146
1149
|
switch (o) {
|
|
1147
1150
|
case "alt":
|
|
1148
1151
|
return e.altKey;
|
|
@@ -1151,18 +1154,18 @@ const He = (e, t = "px") => typeof e == "number" ? e + t : e, H = ({ style: e },
|
|
|
1151
1154
|
case "shift":
|
|
1152
1155
|
return e.shiftKey;
|
|
1153
1156
|
}
|
|
1154
|
-
}) : !1), { abs: I, max:
|
|
1157
|
+
}) : !1), { abs: I, max: Fe, min: We, ceil: Ke } = Math, Ge = (e = []) => ({
|
|
1155
1158
|
stored: e,
|
|
1156
1159
|
selected: [],
|
|
1157
1160
|
touched: [],
|
|
1158
1161
|
changed: { added: [], removed: [] }
|
|
1159
1162
|
});
|
|
1160
|
-
class
|
|
1163
|
+
class en extends Xt {
|
|
1161
1164
|
static version = "mind-elixir-fork";
|
|
1162
1165
|
// Options
|
|
1163
1166
|
_options;
|
|
1164
1167
|
// Selection store
|
|
1165
|
-
_selection =
|
|
1168
|
+
_selection = Ge();
|
|
1166
1169
|
// Area element and clipping element
|
|
1167
1170
|
_area;
|
|
1168
1171
|
_clippingElement;
|
|
@@ -1175,7 +1178,7 @@ class Qt extends Vt {
|
|
|
1175
1178
|
_latestElement;
|
|
1176
1179
|
// Dynamically constructed area rect
|
|
1177
1180
|
_areaLocation = { y1: 0, x2: 0, y2: 0, x1: 0 };
|
|
1178
|
-
_areaRect =
|
|
1181
|
+
_areaRect = Re();
|
|
1179
1182
|
// If a single click is being performed, it's a single-click until the user dragged the mouse
|
|
1180
1183
|
_singleClick = !0;
|
|
1181
1184
|
_frame;
|
|
@@ -1242,22 +1245,22 @@ class Qt extends Vt {
|
|
|
1242
1245
|
// https://stackoverflow.com/a/38268846
|
|
1243
1246
|
pointerEvents: "none",
|
|
1244
1247
|
zIndex: "1"
|
|
1245
|
-
}), this._frame =
|
|
1248
|
+
}), this._frame = Ut((i) => {
|
|
1246
1249
|
this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", i), this._redrawSelectionArea();
|
|
1247
1250
|
}), this.enable();
|
|
1248
1251
|
}
|
|
1249
1252
|
_toggleStartEvents(t = !0) {
|
|
1250
|
-
const { document: n, features: o } = this._options, s = t ? B :
|
|
1253
|
+
const { document: n, features: o } = this._options, s = t ? B : A;
|
|
1251
1254
|
s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, { passive: !1 });
|
|
1252
1255
|
}
|
|
1253
1256
|
_onTapStart(t, n = !1) {
|
|
1254
|
-
const { x: o, y: s, target: i } =
|
|
1255
|
-
if (t instanceof MouseEvent && !
|
|
1257
|
+
const { x: o, y: s, target: i } = ee(t), { document: l, startAreas: r, boundaries: c, features: a, behaviour: h } = this._options, u = i.getBoundingClientRect();
|
|
1258
|
+
if (t instanceof MouseEvent && !Qt(t, h.triggers))
|
|
1256
1259
|
return;
|
|
1257
|
-
const g = K(r, l),
|
|
1258
|
-
this._targetElement =
|
|
1259
|
-
const m = t.composedPath(), p = g.find((
|
|
1260
|
-
if (this._targetBoundary =
|
|
1260
|
+
const g = K(r, l), v = K(c, l);
|
|
1261
|
+
this._targetElement = v.find((f) => Ie(f.getBoundingClientRect(), u));
|
|
1262
|
+
const m = t.composedPath(), p = g.find((f) => m.includes(f));
|
|
1263
|
+
if (this._targetBoundary = v.find((f) => m.includes(f)), !this._targetElement || !p || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1261
1264
|
return;
|
|
1262
1265
|
this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
|
|
1263
1266
|
const d = l.scrollingElement ?? l.body;
|
|
@@ -1267,7 +1270,7 @@ class Qt extends Vt {
|
|
|
1267
1270
|
const {
|
|
1268
1271
|
singleTap: { intersect: n },
|
|
1269
1272
|
range: o
|
|
1270
|
-
} = this._options.features, s =
|
|
1273
|
+
} = this._options.features, s = ee(t);
|
|
1271
1274
|
let i;
|
|
1272
1275
|
if (n === "native")
|
|
1273
1276
|
i = s.target;
|
|
@@ -1275,8 +1278,8 @@ class Qt extends Vt {
|
|
|
1275
1278
|
this.resolveSelectables();
|
|
1276
1279
|
const { x: r, y: c } = s;
|
|
1277
1280
|
i = this._selectables.find((a) => {
|
|
1278
|
-
const { right:
|
|
1279
|
-
return r <
|
|
1281
|
+
const { right: h, left: u, top: g, bottom: v } = a.getBoundingClientRect();
|
|
1282
|
+
return r < h && r > u && c < v && c > g;
|
|
1280
1283
|
});
|
|
1281
1284
|
}
|
|
1282
1285
|
if (!i)
|
|
@@ -1290,12 +1293,12 @@ class Qt extends Vt {
|
|
|
1290
1293
|
}
|
|
1291
1294
|
const { stored: l } = this._selection;
|
|
1292
1295
|
if (this._emitEvent("start", t), t.shiftKey && o && this._latestElement) {
|
|
1293
|
-
const r = this._latestElement, [c, a] = r.compareDocumentPosition(i) & 4 ? [i, r] : [r, i],
|
|
1296
|
+
const r = this._latestElement, [c, a] = r.compareDocumentPosition(i) & 4 ? [i, r] : [r, i], h = [
|
|
1294
1297
|
...this._selectables.filter((u) => u.compareDocumentPosition(c) & 4 && u.compareDocumentPosition(a) & 2),
|
|
1295
1298
|
c,
|
|
1296
1299
|
a
|
|
1297
1300
|
];
|
|
1298
|
-
this.select(
|
|
1301
|
+
this.select(h), this._latestElement = r;
|
|
1299
1302
|
} else 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);
|
|
1300
1303
|
}
|
|
1301
1304
|
_delayedTapMove(t) {
|
|
@@ -1303,14 +1306,14 @@ class Qt extends Vt {
|
|
|
1303
1306
|
container: n,
|
|
1304
1307
|
document: o,
|
|
1305
1308
|
behaviour: { startThreshold: s }
|
|
1306
|
-
} = this._options, { x1: i, y1: l } = this._areaLocation, { x: r, y: c } =
|
|
1309
|
+
} = this._options, { x1: i, y1: l } = this._areaLocation, { x: r, y: c } = ee(t);
|
|
1307
1310
|
if (
|
|
1308
1311
|
// Single number for both coordinates
|
|
1309
1312
|
typeof s == "number" && I(r + c - (i + l)) >= s || // Different x and y threshold
|
|
1310
1313
|
typeof s == "object" && I(r - i) >= s.x || I(c - l) >= s.y
|
|
1311
1314
|
) {
|
|
1312
|
-
if (
|
|
1313
|
-
|
|
1315
|
+
if (A(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1316
|
+
A(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
|
|
1314
1317
|
return;
|
|
1315
1318
|
}
|
|
1316
1319
|
B(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), H(this._area, "display", "block"), K(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 && (B(this._targetElement, "wheel", this._wheelScroll, { passive: !1 }), B(this._options.document, "keydown", this._keyboardScroll, { passive: !1 }), this._selectables = this._selectables.filter((a) => this._targetElement.contains(a))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
|
|
@@ -1340,7 +1343,7 @@ class Qt extends Vt {
|
|
|
1340
1343
|
_onTapMove(t) {
|
|
1341
1344
|
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: l } = s.behaviour.scrolling;
|
|
1342
1345
|
this._targetElement;
|
|
1343
|
-
const { x: r, y: c } =
|
|
1346
|
+
const { x: r, y: c } = ee(t);
|
|
1344
1347
|
if (o.x2 = r, o.y2 = c, this._lastMousePosition.x = r, this._lastMousePosition.y = c, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
|
|
1345
1348
|
this._scrollingActive = !0;
|
|
1346
1349
|
const a = () => {
|
|
@@ -1348,10 +1351,10 @@ class Qt extends Vt {
|
|
|
1348
1351
|
this._scrollingActive = !1;
|
|
1349
1352
|
return;
|
|
1350
1353
|
}
|
|
1351
|
-
const
|
|
1352
|
-
if (
|
|
1353
|
-
const u = n.x ?
|
|
1354
|
-
(u || g) && (
|
|
1354
|
+
const h = this._options.mindElixirInstance;
|
|
1355
|
+
if (h && h.move) {
|
|
1356
|
+
const u = n.x ? Ke(n.x / l) : 0, g = n.y ? Ke(n.y / l) : 0;
|
|
1357
|
+
(u || g) && (h.move(-u, -g), o.x1 -= u, o.y1 -= g);
|
|
1355
1358
|
}
|
|
1356
1359
|
i.next(t), requestAnimationFrame(a);
|
|
1357
1360
|
};
|
|
@@ -1362,7 +1365,7 @@ class Qt extends Vt {
|
|
|
1362
1365
|
}
|
|
1363
1366
|
_handleMoveEvent(t) {
|
|
1364
1367
|
const { features: n } = this._options;
|
|
1365
|
-
(n.touch &&
|
|
1368
|
+
(n.touch && Jt() || this._scrollAvailable && Zt()) && t.preventDefault();
|
|
1366
1369
|
}
|
|
1367
1370
|
_onScroll() {
|
|
1368
1371
|
const {
|
|
@@ -1372,7 +1375,7 @@ class Qt extends Vt {
|
|
|
1372
1375
|
this._areaLocation.x1 += t.x - s, this._areaLocation.y1 += t.y - o, t.x = s, t.y = o, this._setupSelectionArea(), this._frame.next(null);
|
|
1373
1376
|
}
|
|
1374
1377
|
_onStartAreaScroll() {
|
|
1375
|
-
this._targetBoundaryScrolled = !0,
|
|
1378
|
+
this._targetBoundaryScrolled = !0, A(this._targetElement, "scroll", this._onStartAreaScroll);
|
|
1376
1379
|
}
|
|
1377
1380
|
_wheelScroll(t) {
|
|
1378
1381
|
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;
|
|
@@ -1392,12 +1395,12 @@ class Qt extends Vt {
|
|
|
1392
1395
|
let { x2: c, y2: a } = n;
|
|
1393
1396
|
const {
|
|
1394
1397
|
behaviour: {
|
|
1395
|
-
scrolling: { startScrollMargins:
|
|
1398
|
+
scrolling: { startScrollMargins: h }
|
|
1396
1399
|
}
|
|
1397
1400
|
} = s;
|
|
1398
|
-
c < i.left +
|
|
1399
|
-
const u =
|
|
1400
|
-
this._areaRect =
|
|
1401
|
+
c < i.left + h.x ? (t.x = -I(i.left - c + h.x), c = c < i.left ? i.left : c) : c > i.right - h.x ? (t.x = I(i.left + i.width - c - h.x), c = c > i.right ? i.right : c) : t.x = 0, a < i.top + h.y ? (t.y = -I(i.top - a + h.y), a = a < i.top ? i.top : a) : a > i.bottom - h.y ? (t.y = I(i.top + i.height - a - h.y), a = a > i.bottom ? i.bottom : a) : t.y = 0;
|
|
1402
|
+
const u = We(l, c), g = We(r, a), v = Fe(l, c), m = Fe(r, a);
|
|
1403
|
+
this._areaRect = Re(u, g, v - u, m - g);
|
|
1401
1404
|
}
|
|
1402
1405
|
_redrawSelectionArea() {
|
|
1403
1406
|
const { x: t, y: n, width: o, height: s } = this._areaRect, { style: i } = this._area;
|
|
@@ -1405,32 +1408,32 @@ class Qt extends Vt {
|
|
|
1405
1408
|
}
|
|
1406
1409
|
_onTapStop(t, n) {
|
|
1407
1410
|
const { document: o, features: s } = this._options, { _singleClick: i } = this;
|
|
1408
|
-
|
|
1411
|
+
A(this._targetElement, "scroll", this._onStartAreaScroll), A(o, ["mousemove", "touchmove"], this._delayedTapMove), A(o, ["touchmove", "mousemove"], this._onTapMove), A(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop), A(o, "scroll", this._onScroll), this._keepSelection(), t && i && s.singleTap.allow ? this._onSingleTap(t) : !i && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, A(this._targetElement, "wheel", this._wheelScroll, { passive: !0 }), A(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), this._frame?.cancel(), H(this._area, "display", "none");
|
|
1409
1412
|
}
|
|
1410
1413
|
_updateElementSelection() {
|
|
1411
|
-
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: r } = o, { intersect: c, overlap: a } = n.behaviour,
|
|
1414
|
+
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: r } = o, { intersect: c, overlap: a } = n.behaviour, h = a === "invert", u = [], g = [], v = [];
|
|
1412
1415
|
for (let p = 0; p < t.length; p++) {
|
|
1413
1416
|
const d = t[p];
|
|
1414
|
-
if (
|
|
1417
|
+
if (Ie(s, d.getBoundingClientRect(), c)) {
|
|
1415
1418
|
if (l.includes(d))
|
|
1416
1419
|
i.includes(d) && !r.includes(d) && r.push(d);
|
|
1417
|
-
else if (
|
|
1418
|
-
|
|
1420
|
+
else if (h && i.includes(d)) {
|
|
1421
|
+
v.push(d);
|
|
1419
1422
|
continue;
|
|
1420
1423
|
} else
|
|
1421
1424
|
g.push(d);
|
|
1422
1425
|
u.push(d);
|
|
1423
1426
|
}
|
|
1424
1427
|
}
|
|
1425
|
-
|
|
1428
|
+
h && g.push(...i.filter((p) => !l.includes(p)));
|
|
1426
1429
|
const m = a === "keep";
|
|
1427
1430
|
for (let p = 0; p < l.length; p++) {
|
|
1428
1431
|
const d = l[p];
|
|
1429
1432
|
!u.includes(d) && !// Check if the user wants to keep previously selected elements, e.g.,
|
|
1430
1433
|
// not make them part of the current selection as soon as they're touched.
|
|
1431
|
-
(m && i.includes(d)) &&
|
|
1434
|
+
(m && i.includes(d)) && v.push(d);
|
|
1432
1435
|
}
|
|
1433
|
-
o.selected = u, o.changed = { added: g, removed:
|
|
1436
|
+
o.selected = u, o.changed = { added: g, removed: v }, this._latestElement = void 0;
|
|
1434
1437
|
}
|
|
1435
1438
|
_emitEvent(t, n) {
|
|
1436
1439
|
return this.emit(t, {
|
|
@@ -1490,7 +1493,7 @@ class Qt extends Vt {
|
|
|
1490
1493
|
*/
|
|
1491
1494
|
clearSelection(t = !0, n = !1) {
|
|
1492
1495
|
const { selected: o, stored: s, changed: i } = this._selection;
|
|
1493
|
-
i.added = [], i.removed.push(...o, ...t ? s : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection =
|
|
1496
|
+
i.added = [], i.removed.push(...o, ...t ? s : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Ge(t ? [] : s);
|
|
1494
1497
|
}
|
|
1495
1498
|
/**
|
|
1496
1499
|
* @returns {Array} Selected elements
|
|
@@ -1563,8 +1566,8 @@ class Qt extends Vt {
|
|
|
1563
1566
|
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(...l.filter((r) => !i.removed.includes(r))), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null));
|
|
1564
1567
|
}
|
|
1565
1568
|
}
|
|
1566
|
-
function
|
|
1567
|
-
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new
|
|
1569
|
+
function tn(e) {
|
|
1570
|
+
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new en({
|
|
1568
1571
|
selectables: [".map-container me-tpc"],
|
|
1569
1572
|
boundaries: [e.container],
|
|
1570
1573
|
container: e.selectionContainer,
|
|
@@ -1623,10 +1626,10 @@ function en(e) {
|
|
|
1623
1626
|
);
|
|
1624
1627
|
e.selection = n;
|
|
1625
1628
|
}
|
|
1626
|
-
const
|
|
1629
|
+
const nn = function(e, t = !0) {
|
|
1627
1630
|
this.theme = e;
|
|
1628
1631
|
const o = {
|
|
1629
|
-
...(e.type === "dark" ?
|
|
1632
|
+
...(e.type === "dark" ? we : be).cssVar,
|
|
1630
1633
|
...e.cssVar
|
|
1631
1634
|
}, s = Object.keys(o);
|
|
1632
1635
|
for (let i = 0; i < s.length; i++) {
|
|
@@ -1638,32 +1641,32 @@ const tn = function(e, t = !0) {
|
|
|
1638
1641
|
const t = e.parent?.children, n = t?.indexOf(e) ?? 0;
|
|
1639
1642
|
return { siblings: t, index: n };
|
|
1640
1643
|
};
|
|
1641
|
-
function
|
|
1644
|
+
function on(e) {
|
|
1642
1645
|
const { siblings: t, index: n } = V(e);
|
|
1643
1646
|
if (t === void 0) return;
|
|
1644
1647
|
const o = t[n];
|
|
1645
1648
|
n === 0 ? (t[n] = t[t.length - 1], t[t.length - 1] = o) : (t[n] = t[n - 1], t[n - 1] = o);
|
|
1646
1649
|
}
|
|
1647
|
-
function
|
|
1650
|
+
function sn(e) {
|
|
1648
1651
|
const { siblings: t, index: n } = V(e);
|
|
1649
1652
|
if (t === void 0) return;
|
|
1650
1653
|
const o = t[n];
|
|
1651
1654
|
n === t.length - 1 ? (t[n] = t[0], t[0] = o) : (t[n] = t[n + 1], t[n + 1] = o);
|
|
1652
1655
|
}
|
|
1653
|
-
function
|
|
1656
|
+
function nt(e) {
|
|
1654
1657
|
const { siblings: t, index: n } = V(e);
|
|
1655
1658
|
return t === void 0 ? 0 : (t.splice(n, 1), t.length);
|
|
1656
1659
|
}
|
|
1657
|
-
function
|
|
1660
|
+
function rn(e, t, n) {
|
|
1658
1661
|
const { siblings: o, index: s } = V(n);
|
|
1659
1662
|
o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
|
|
1660
1663
|
}
|
|
1661
|
-
function
|
|
1664
|
+
function ln(e, t) {
|
|
1662
1665
|
const { siblings: n, index: o } = V(e);
|
|
1663
1666
|
n !== void 0 && (n[o] = t, t.children = [e]);
|
|
1664
1667
|
}
|
|
1665
|
-
function
|
|
1666
|
-
if (
|
|
1668
|
+
function ot(e, t, n) {
|
|
1669
|
+
if (nt(t), n.parent?.parent || (t.direction = n.direction), e === "in")
|
|
1667
1670
|
n.children ? n.children.push(t) : n.children = [t];
|
|
1668
1671
|
else {
|
|
1669
1672
|
t.direction !== void 0 && (t.direction = n.direction);
|
|
@@ -1672,7 +1675,7 @@ function nt(e, t, n) {
|
|
|
1672
1675
|
e === "before" ? o.splice(s, 0, t) : o.splice(s + 1, 0, t);
|
|
1673
1676
|
}
|
|
1674
1677
|
}
|
|
1675
|
-
const
|
|
1678
|
+
const cn = function({ map: e, direction: t }, n) {
|
|
1676
1679
|
if (t === 0)
|
|
1677
1680
|
return 0;
|
|
1678
1681
|
if (t === 1)
|
|
@@ -1681,55 +1684,55 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1681
1684
|
const o = e.querySelector(".lhs")?.childElementCount || 0, s = e.querySelector(".rhs")?.childElementCount || 0;
|
|
1682
1685
|
return o <= s ? (n.direction = 0, 0) : (n.direction = 1, 1);
|
|
1683
1686
|
}
|
|
1684
|
-
},
|
|
1687
|
+
}, st = function(e, t, n) {
|
|
1685
1688
|
const o = n.children[0].children[0], s = t.parentElement;
|
|
1686
1689
|
if (s.tagName === "ME-PARENT") {
|
|
1687
|
-
if (
|
|
1690
|
+
if (J(o), s.children[1])
|
|
1688
1691
|
s.nextSibling.appendChild(n);
|
|
1689
1692
|
else {
|
|
1690
1693
|
const i = e.createChildren([n]);
|
|
1691
|
-
s.appendChild(
|
|
1694
|
+
s.appendChild(Ne(!0)), s.insertAdjacentElement("afterend", i);
|
|
1692
1695
|
}
|
|
1693
1696
|
e.linkDiv(n.offsetParent);
|
|
1694
|
-
} else s.tagName === "ME-ROOT" && (
|
|
1695
|
-
},
|
|
1697
|
+
} else s.tagName === "ME-ROOT" && (cn(e, o.nodeObj) === 0 ? e.container.querySelector(".lhs")?.appendChild(n) : e.container.querySelector(".rhs")?.appendChild(n), e.linkDiv());
|
|
1698
|
+
}, an = function(e, t) {
|
|
1696
1699
|
const n = e.parentNode;
|
|
1697
1700
|
if (t === 0) {
|
|
1698
1701
|
const o = n.parentNode.parentNode;
|
|
1699
1702
|
o.tagName !== "ME-MAIN" && (o.previousSibling.children[1].remove(), o.remove());
|
|
1700
1703
|
}
|
|
1701
1704
|
n.parentNode.remove();
|
|
1702
|
-
},
|
|
1705
|
+
}, it = {
|
|
1703
1706
|
before: "beforebegin",
|
|
1704
1707
|
after: "afterend"
|
|
1705
|
-
},
|
|
1708
|
+
}, J = function(e) {
|
|
1706
1709
|
const n = e.parentElement.parentElement.lastElementChild;
|
|
1707
1710
|
n?.tagName === "svg" && n?.remove();
|
|
1708
|
-
},
|
|
1709
|
-
const n = e.nodeObj, o =
|
|
1711
|
+
}, dn = function(e, t) {
|
|
1712
|
+
const n = e.nodeObj, o = Ee(n);
|
|
1710
1713
|
o.style && t.style && (t.style = Object.assign(o.style, t.style));
|
|
1711
1714
|
const s = Object.assign(n, t);
|
|
1712
|
-
|
|
1715
|
+
Se.call(this, e, s), this.linkDiv(), this.bus.fire("operation", {
|
|
1713
1716
|
name: "reshapeNode",
|
|
1714
1717
|
obj: s,
|
|
1715
1718
|
origin: o
|
|
1716
1719
|
});
|
|
1717
|
-
},
|
|
1720
|
+
}, ke = function(e, t, n) {
|
|
1718
1721
|
if (!t) return null;
|
|
1719
1722
|
const o = t.nodeObj;
|
|
1720
1723
|
o.expanded === !1 && (e.expandNode(t, !0), t = e.findEle(o.id));
|
|
1721
1724
|
const s = n || e.generateNewObj();
|
|
1722
1725
|
o.children ? o.children.push(s) : o.children = [s], R(e.nodeData);
|
|
1723
1726
|
const { grp: i, top: l } = e.createWrapper(s);
|
|
1724
|
-
return
|
|
1725
|
-
},
|
|
1727
|
+
return st(e, t, i), { newTop: l, newNodeObj: s };
|
|
1728
|
+
}, hn = function(e, t, n) {
|
|
1726
1729
|
const o = t || this.currentNode;
|
|
1727
1730
|
if (!o) return;
|
|
1728
1731
|
const s = o.nodeObj;
|
|
1729
1732
|
if (s.parent) {
|
|
1730
1733
|
if (!s.parent?.parent && this.direction === 2) {
|
|
1731
|
-
const a = this.map.querySelector(".lhs")?.childElementCount || 0,
|
|
1732
|
-
if (!a || !
|
|
1734
|
+
const a = this.map.querySelector(".lhs")?.childElementCount || 0, h = this.map.querySelector(".rhs")?.childElementCount || 0;
|
|
1735
|
+
if (!a || !h) {
|
|
1733
1736
|
this.addChild(this.findEle(s.parent.id), n);
|
|
1734
1737
|
return;
|
|
1735
1738
|
}
|
|
@@ -1740,59 +1743,59 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1740
1743
|
}
|
|
1741
1744
|
const i = n || this.generateNewObj();
|
|
1742
1745
|
if (!s.parent?.parent) {
|
|
1743
|
-
const a = o.closest("me-main").className ===
|
|
1746
|
+
const a = o.closest("me-main").className === D.LHS ? 0 : 1;
|
|
1744
1747
|
i.direction = a;
|
|
1745
1748
|
}
|
|
1746
|
-
|
|
1749
|
+
rn(i, e, s), R(this.nodeData);
|
|
1747
1750
|
const l = o.parentElement, { grp: r, top: c } = this.createWrapper(i);
|
|
1748
|
-
l.parentElement.insertAdjacentElement(
|
|
1751
|
+
l.parentElement.insertAdjacentElement(it[e], r), this.linkDiv(r.offsetParent), n || this.editTopic(c.firstChild), this.bus.fire("operation", {
|
|
1749
1752
|
name: "insertSibling",
|
|
1750
1753
|
type: e,
|
|
1751
1754
|
obj: i
|
|
1752
1755
|
}), this.selectNode(c.firstChild, !0);
|
|
1753
|
-
},
|
|
1756
|
+
}, fn = function(e, t) {
|
|
1754
1757
|
const n = e || this.currentNode;
|
|
1755
1758
|
if (!n) return;
|
|
1756
|
-
|
|
1759
|
+
J(n);
|
|
1757
1760
|
const o = n.nodeObj;
|
|
1758
1761
|
if (!o.parent)
|
|
1759
1762
|
return;
|
|
1760
1763
|
const s = t || this.generateNewObj();
|
|
1761
|
-
|
|
1764
|
+
ln(o, s), R(this.nodeData);
|
|
1762
1765
|
const i = n.parentElement.parentElement, { grp: l, top: r } = this.createWrapper(s, !0);
|
|
1763
|
-
r.appendChild(
|
|
1766
|
+
r.appendChild(Ne(!0)), i.insertAdjacentElement("afterend", l);
|
|
1764
1767
|
const c = this.createChildren([i]);
|
|
1765
1768
|
r.insertAdjacentElement("afterend", c), this.linkDiv(), t || this.editTopic(r.firstChild), this.selectNode(r.firstChild, !0), this.bus.fire("operation", {
|
|
1766
1769
|
name: "insertParent",
|
|
1767
1770
|
obj: s
|
|
1768
1771
|
});
|
|
1769
|
-
},
|
|
1772
|
+
}, un = function(e, t) {
|
|
1770
1773
|
const n = e || this.currentNode;
|
|
1771
1774
|
if (!n) return;
|
|
1772
|
-
const o =
|
|
1775
|
+
const o = ke(this, n, t);
|
|
1773
1776
|
if (!o) return;
|
|
1774
1777
|
const { newTop: s, newNodeObj: i } = o;
|
|
1775
1778
|
this.bus.fire("operation", {
|
|
1776
1779
|
name: "addChild",
|
|
1777
1780
|
obj: i
|
|
1778
1781
|
}), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
|
|
1779
|
-
},
|
|
1780
|
-
const n =
|
|
1781
|
-
|
|
1782
|
-
const o =
|
|
1782
|
+
}, pn = function(e, t) {
|
|
1783
|
+
const n = Ee(e.nodeObj);
|
|
1784
|
+
xe(n);
|
|
1785
|
+
const o = ke(this, t, n);
|
|
1783
1786
|
if (!o) return;
|
|
1784
1787
|
const { newNodeObj: s } = o;
|
|
1785
1788
|
this.selectNode(this.findEle(s.id)), this.bus.fire("operation", {
|
|
1786
1789
|
name: "copyNode",
|
|
1787
1790
|
obj: s
|
|
1788
1791
|
});
|
|
1789
|
-
},
|
|
1790
|
-
e =
|
|
1792
|
+
}, gn = function(e, t) {
|
|
1793
|
+
e = ae(e);
|
|
1791
1794
|
const n = [];
|
|
1792
1795
|
for (let o = 0; o < e.length; o++) {
|
|
1793
|
-
const s = e[o], i =
|
|
1794
|
-
|
|
1795
|
-
const l =
|
|
1796
|
+
const s = e[o], i = Ee(s.nodeObj);
|
|
1797
|
+
xe(i);
|
|
1798
|
+
const l = ke(this, t, i);
|
|
1796
1799
|
if (!l) return;
|
|
1797
1800
|
const { newNodeObj: r } = l;
|
|
1798
1801
|
n.push(r);
|
|
@@ -1801,61 +1804,61 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1801
1804
|
name: "copyNodes",
|
|
1802
1805
|
objs: n
|
|
1803
1806
|
});
|
|
1804
|
-
},
|
|
1807
|
+
}, mn = function(e) {
|
|
1805
1808
|
const t = e || this.currentNode;
|
|
1806
1809
|
if (!t) return;
|
|
1807
1810
|
const n = t.nodeObj;
|
|
1808
|
-
|
|
1811
|
+
on(n);
|
|
1809
1812
|
const o = t.parentNode.parentNode;
|
|
1810
1813
|
o.parentNode.insertBefore(o, o.previousSibling), this.linkDiv(), this.bus.fire("operation", {
|
|
1811
1814
|
name: "moveUpNode",
|
|
1812
1815
|
obj: n
|
|
1813
1816
|
});
|
|
1814
|
-
},
|
|
1817
|
+
}, yn = function(e) {
|
|
1815
1818
|
const t = e || this.currentNode;
|
|
1816
1819
|
if (!t) return;
|
|
1817
1820
|
const n = t.nodeObj;
|
|
1818
|
-
|
|
1821
|
+
sn(n);
|
|
1819
1822
|
const o = t.parentNode.parentNode;
|
|
1820
1823
|
o.nextSibling ? o.nextSibling.insertAdjacentElement("afterend", o) : o.parentNode.prepend(o), this.linkDiv(), this.bus.fire("operation", {
|
|
1821
1824
|
name: "moveDownNode",
|
|
1822
1825
|
obj: n
|
|
1823
1826
|
});
|
|
1824
|
-
},
|
|
1827
|
+
}, vn = function(e) {
|
|
1825
1828
|
if (e.length === 0) return;
|
|
1826
|
-
e =
|
|
1829
|
+
e = ae(e);
|
|
1827
1830
|
for (const n of e) {
|
|
1828
|
-
const o = n.nodeObj, s =
|
|
1829
|
-
|
|
1831
|
+
const o = n.nodeObj, s = nt(o);
|
|
1832
|
+
an(n, s);
|
|
1830
1833
|
}
|
|
1831
1834
|
const t = e[e.length - 1];
|
|
1832
1835
|
this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
|
|
1833
1836
|
name: "removeNodes",
|
|
1834
1837
|
objs: e.map((n) => n.nodeObj)
|
|
1835
1838
|
});
|
|
1836
|
-
},
|
|
1837
|
-
e =
|
|
1839
|
+
}, bn = function(e, t) {
|
|
1840
|
+
e = ae(e);
|
|
1838
1841
|
const n = t.nodeObj;
|
|
1839
1842
|
n.expanded === !1 && (this.expandNode(t, !0), t = this.findEle(n.id));
|
|
1840
1843
|
for (const o of e) {
|
|
1841
1844
|
const s = o.nodeObj;
|
|
1842
|
-
|
|
1845
|
+
ot("in", s, n), R(this.nodeData);
|
|
1843
1846
|
const i = o.parentElement;
|
|
1844
|
-
|
|
1847
|
+
st(this, t, i.parentElement);
|
|
1845
1848
|
}
|
|
1846
1849
|
this.linkDiv(), this.bus.fire("operation", {
|
|
1847
1850
|
name: "moveNodeIn",
|
|
1848
1851
|
objs: e.map((o) => o.nodeObj),
|
|
1849
1852
|
toObj: n
|
|
1850
1853
|
});
|
|
1851
|
-
},
|
|
1852
|
-
e =
|
|
1854
|
+
}, rt = (e, t, n, o) => {
|
|
1855
|
+
e = ae(e), t === "after" && (e = e.reverse());
|
|
1853
1856
|
const s = n.nodeObj, i = [];
|
|
1854
1857
|
for (const l of e) {
|
|
1855
1858
|
const r = l.nodeObj;
|
|
1856
|
-
|
|
1859
|
+
ot(t, r, s), R(o.nodeData), J(l);
|
|
1857
1860
|
const c = l.parentElement.parentNode;
|
|
1858
|
-
i.includes(c.parentElement) || i.push(c.parentElement), n.parentElement.parentNode.insertAdjacentElement(
|
|
1861
|
+
i.includes(c.parentElement) || i.push(c.parentElement), n.parentElement.parentNode.insertAdjacentElement(it[t], c);
|
|
1859
1862
|
}
|
|
1860
1863
|
for (const l of i)
|
|
1861
1864
|
l.childElementCount === 0 && l.tagName !== "ME-MAIN" && (l.previousSibling.children[1].remove(), l.remove());
|
|
@@ -1864,34 +1867,34 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1864
1867
|
objs: e.map((l) => l.nodeObj),
|
|
1865
1868
|
toObj: s
|
|
1866
1869
|
});
|
|
1867
|
-
}, bn = function(e, t) {
|
|
1868
|
-
it(e, "before", t, this);
|
|
1869
1870
|
}, wn = function(e, t) {
|
|
1870
|
-
|
|
1871
|
-
}, xn = function(e) {
|
|
1871
|
+
rt(e, "before", t, this);
|
|
1872
|
+
}, xn = function(e, t) {
|
|
1873
|
+
rt(e, "after", t, this);
|
|
1874
|
+
}, En = function(e) {
|
|
1872
1875
|
const t = e || this.currentNode;
|
|
1873
1876
|
t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t));
|
|
1874
|
-
},
|
|
1877
|
+
}, Cn = function(e, t) {
|
|
1875
1878
|
e.text.textContent = t, e.nodeObj.topic = t, this.linkDiv();
|
|
1876
|
-
},
|
|
1879
|
+
}, lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1877
1880
|
__proto__: null,
|
|
1878
|
-
addChild:
|
|
1879
|
-
beginEdit:
|
|
1880
|
-
copyNode:
|
|
1881
|
-
copyNodes:
|
|
1882
|
-
insertParent:
|
|
1883
|
-
insertSibling:
|
|
1884
|
-
moveDownNode:
|
|
1885
|
-
moveNodeAfter:
|
|
1886
|
-
moveNodeBefore:
|
|
1887
|
-
moveNodeIn:
|
|
1888
|
-
moveUpNode:
|
|
1889
|
-
removeNodes:
|
|
1890
|
-
reshapeNode:
|
|
1891
|
-
rmSubline:
|
|
1892
|
-
setNodeTopic:
|
|
1881
|
+
addChild: un,
|
|
1882
|
+
beginEdit: En,
|
|
1883
|
+
copyNode: pn,
|
|
1884
|
+
copyNodes: gn,
|
|
1885
|
+
insertParent: fn,
|
|
1886
|
+
insertSibling: hn,
|
|
1887
|
+
moveDownNode: yn,
|
|
1888
|
+
moveNodeAfter: xn,
|
|
1889
|
+
moveNodeBefore: wn,
|
|
1890
|
+
moveNodeIn: bn,
|
|
1891
|
+
moveUpNode: mn,
|
|
1892
|
+
removeNodes: vn,
|
|
1893
|
+
reshapeNode: dn,
|
|
1894
|
+
rmSubline: J,
|
|
1895
|
+
setNodeTopic: Cn
|
|
1893
1896
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1894
|
-
function
|
|
1897
|
+
function Sn(e) {
|
|
1895
1898
|
return {
|
|
1896
1899
|
nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
|
|
1897
1900
|
arrows: e.arrows,
|
|
@@ -1900,74 +1903,74 @@ function Cn(e) {
|
|
|
1900
1903
|
theme: e.theme
|
|
1901
1904
|
};
|
|
1902
1905
|
}
|
|
1903
|
-
const
|
|
1906
|
+
const Nn = function(e) {
|
|
1904
1907
|
const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
|
|
1905
1908
|
if (n.top > o.bottom || n.bottom < o.top || n.left > o.right || n.right < o.left) {
|
|
1906
|
-
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, a = i - r,
|
|
1907
|
-
this.move(-a, -
|
|
1909
|
+
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, a = i - r, h = l - c;
|
|
1910
|
+
this.move(-a, -h, !0);
|
|
1908
1911
|
}
|
|
1909
|
-
},
|
|
1912
|
+
}, kn = function(e, t, n) {
|
|
1910
1913
|
this.clearSelection(), this.scrollIntoView(e), this.selection.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
|
|
1911
|
-
}, kn = function(e) {
|
|
1912
|
-
this.selection.select(e);
|
|
1913
1914
|
}, _n = function(e) {
|
|
1915
|
+
this.selection.select(e);
|
|
1916
|
+
}, Tn = function(e) {
|
|
1914
1917
|
this.selection.deselect(e);
|
|
1915
|
-
}, Tn = function() {
|
|
1916
|
-
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
1917
1918
|
}, Ln = function() {
|
|
1918
|
-
|
|
1919
|
+
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
1920
|
+
}, An = function() {
|
|
1921
|
+
const e = Sn(this);
|
|
1919
1922
|
return JSON.stringify(e, (t, n) => {
|
|
1920
1923
|
if (!(t === "parent" && typeof n != "string"))
|
|
1921
1924
|
return n;
|
|
1922
1925
|
});
|
|
1923
|
-
}, An = function() {
|
|
1924
|
-
return JSON.parse(this.getDataString());
|
|
1925
1926
|
}, Mn = function() {
|
|
1926
|
-
this.
|
|
1927
|
+
return JSON.parse(this.getDataString());
|
|
1927
1928
|
}, Dn = function() {
|
|
1929
|
+
this.editable = !0;
|
|
1930
|
+
}, Pn = function() {
|
|
1928
1931
|
this.editable = !1;
|
|
1929
|
-
},
|
|
1932
|
+
}, $n = function(e, t = { x: 0, y: 0 }) {
|
|
1930
1933
|
if (e < this.scaleMin || e > this.scaleMax) return;
|
|
1931
|
-
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 } =
|
|
1932
|
-
this.map.style.transform = `translate(${c -
|
|
1933
|
-
},
|
|
1934
|
+
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 } = ct(this), r = this.map.style.transform, { x: c, y: a } = Xe(r), h = c - i, u = a - l, g = this.scaleVal, v = (-o + h) * (1 - e / g), m = (-s + u) * (1 - e / g);
|
|
1935
|
+
this.map.style.transform = `translate(${c - v}px, ${a - m}px) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
|
|
1936
|
+
}, On = function() {
|
|
1934
1937
|
const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
|
|
1935
1938
|
this.scaleVal = n, this.map.style.transform = "scale(" + n + ")", this.bus.fire("scale", n);
|
|
1936
|
-
},
|
|
1939
|
+
}, jn = function(e, t, n = !1) {
|
|
1937
1940
|
const { map: o, scaleVal: s, bus: i } = this, l = o.style.transform;
|
|
1938
|
-
let { x: r, y: c } =
|
|
1941
|
+
let { x: r, y: c } = Xe(l);
|
|
1939
1942
|
r += e, c += t, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
1940
1943
|
o.style.transition = "none";
|
|
1941
1944
|
}, 300)), o.style.transform = `translate(${r}px, ${c}px) scale(${s})`, i.fire("move", { dx: e, dy: t });
|
|
1942
|
-
},
|
|
1945
|
+
}, ct = (e) => {
|
|
1943
1946
|
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;
|
|
1944
|
-
let a,
|
|
1945
|
-
return e.alignment === "root" ? (a = t.offsetWidth / 2 - l - r / 2,
|
|
1946
|
-
},
|
|
1947
|
-
const { map: e, container: t } = this, { dx: n, dy: o } =
|
|
1947
|
+
let a, h;
|
|
1948
|
+
return e.alignment === "root" ? (a = t.offsetWidth / 2 - l - r / 2, h = t.offsetHeight / 2 - i - c / 2, n.style.transformOrigin = `${l + r / 2}px 50%`) : (a = (t.offsetWidth - o.offsetWidth) / 2, h = (t.offsetHeight - o.offsetHeight) / 2, n.style.transformOrigin = "50% 50%"), { dx: a, dy: h };
|
|
1949
|
+
}, Hn = function() {
|
|
1950
|
+
const { map: e, container: t } = this, { dx: n, dy: o } = ct(this);
|
|
1948
1951
|
t.scrollTop = 0, t.scrollLeft = 0, e.style.transform = `translate(${n}px, ${o}px) scale(${this.scaleVal})`;
|
|
1949
|
-
}, Hn = function(e) {
|
|
1950
|
-
e(this);
|
|
1951
1952
|
}, Bn = function(e) {
|
|
1953
|
+
e(this);
|
|
1954
|
+
}, Rn = function(e) {
|
|
1952
1955
|
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());
|
|
1953
|
-
}, Rn = function() {
|
|
1954
|
-
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
1955
1956
|
}, In = function() {
|
|
1956
|
-
this.
|
|
1957
|
+
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
1957
1958
|
}, Fn = function() {
|
|
1958
|
-
this.direction =
|
|
1959
|
+
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
1959
1960
|
}, Wn = function() {
|
|
1961
|
+
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
1962
|
+
}, Kn = function() {
|
|
1960
1963
|
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
1961
|
-
},
|
|
1964
|
+
}, Gn = function(e) {
|
|
1962
1965
|
this.locale = e, this.refresh();
|
|
1963
|
-
},
|
|
1966
|
+
}, Yn = function(e, t) {
|
|
1964
1967
|
const n = e.nodeObj;
|
|
1965
1968
|
typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
1966
1969
|
const o = e.getBoundingClientRect(), s = {
|
|
1967
1970
|
x: o.left,
|
|
1968
1971
|
y: o.top
|
|
1969
1972
|
}, i = e.parentNode, l = i.children[1];
|
|
1970
|
-
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "",
|
|
1973
|
+
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "", J(e), n.expanded) {
|
|
1971
1974
|
const u = this.createChildren(
|
|
1972
1975
|
n.children.map((g) => this.createWrapper(g).grp)
|
|
1973
1976
|
);
|
|
@@ -1978,9 +1981,9 @@ const Sn = function(e) {
|
|
|
1978
1981
|
const r = e.getBoundingClientRect(), c = {
|
|
1979
1982
|
x: r.left,
|
|
1980
1983
|
y: r.top
|
|
1981
|
-
}, a = s.x - c.x,
|
|
1982
|
-
this.move(a,
|
|
1983
|
-
},
|
|
1984
|
+
}, a = s.x - c.x, h = s.y - c.y;
|
|
1985
|
+
this.move(a, h), this.bus.fire("expandNode", n);
|
|
1986
|
+
}, zn = function(e, t) {
|
|
1984
1987
|
const n = e.nodeObj, o = e.getBoundingClientRect(), s = {
|
|
1985
1988
|
x: o.left,
|
|
1986
1989
|
y: o.top
|
|
@@ -1991,34 +1994,34 @@ const Sn = function(e) {
|
|
|
1991
1994
|
y: i.top
|
|
1992
1995
|
}, r = s.x - l.x, c = s.y - l.y;
|
|
1993
1996
|
this.move(r, c);
|
|
1994
|
-
},
|
|
1997
|
+
}, qn = function(e) {
|
|
1995
1998
|
this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)), R(this.nodeData), this.layout(), this.linkDiv();
|
|
1996
|
-
},
|
|
1999
|
+
}, Vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1997
2000
|
__proto__: null,
|
|
1998
|
-
cancelFocus:
|
|
1999
|
-
clearSelection:
|
|
2000
|
-
disableEdit:
|
|
2001
|
-
enableEdit:
|
|
2002
|
-
expandNode:
|
|
2003
|
-
expandNodeAll:
|
|
2004
|
-
focusNode:
|
|
2005
|
-
getData:
|
|
2006
|
-
getDataString:
|
|
2007
|
-
initLeft:
|
|
2008
|
-
initRight:
|
|
2009
|
-
initSide:
|
|
2010
|
-
install:
|
|
2011
|
-
move:
|
|
2012
|
-
refresh:
|
|
2013
|
-
scale:
|
|
2014
|
-
scaleFit:
|
|
2015
|
-
scrollIntoView:
|
|
2016
|
-
selectNode:
|
|
2017
|
-
selectNodes:
|
|
2018
|
-
setLocale:
|
|
2019
|
-
toCenter:
|
|
2020
|
-
unselectNodes:
|
|
2021
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2001
|
+
cancelFocus: In,
|
|
2002
|
+
clearSelection: Ln,
|
|
2003
|
+
disableEdit: Pn,
|
|
2004
|
+
enableEdit: Dn,
|
|
2005
|
+
expandNode: Yn,
|
|
2006
|
+
expandNodeAll: zn,
|
|
2007
|
+
focusNode: Rn,
|
|
2008
|
+
getData: Mn,
|
|
2009
|
+
getDataString: An,
|
|
2010
|
+
initLeft: Fn,
|
|
2011
|
+
initRight: Wn,
|
|
2012
|
+
initSide: Kn,
|
|
2013
|
+
install: Bn,
|
|
2014
|
+
move: jn,
|
|
2015
|
+
refresh: qn,
|
|
2016
|
+
scale: $n,
|
|
2017
|
+
scaleFit: On,
|
|
2018
|
+
scrollIntoView: Nn,
|
|
2019
|
+
selectNode: kn,
|
|
2020
|
+
selectNodes: _n,
|
|
2021
|
+
setLocale: Gn,
|
|
2022
|
+
toCenter: Hn,
|
|
2023
|
+
unselectNodes: Tn
|
|
2024
|
+
}, Symbol.toStringTag, { value: "Module" })), Xn = function(e) {
|
|
2022
2025
|
return {
|
|
2023
2026
|
dom: e,
|
|
2024
2027
|
moved: !1,
|
|
@@ -2041,7 +2044,7 @@ const Sn = function(e) {
|
|
|
2041
2044
|
},
|
|
2042
2045
|
cb: null,
|
|
2043
2046
|
init(t, n) {
|
|
2044
|
-
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy =
|
|
2047
|
+
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = Ce([
|
|
2045
2048
|
{ dom: t, evt: "pointermove", func: this.handlePointerMove },
|
|
2046
2049
|
{ dom: t, evt: "pointerleave", func: this.handleClear },
|
|
2047
2050
|
{ dom: t, evt: "pointerup", func: this.handleClear },
|
|
@@ -2053,19 +2056,19 @@ const Sn = function(e) {
|
|
|
2053
2056
|
this.moved = !1, this.pointerdown = !1;
|
|
2054
2057
|
}
|
|
2055
2058
|
};
|
|
2056
|
-
},
|
|
2057
|
-
create:
|
|
2058
|
-
},
|
|
2059
|
-
function
|
|
2059
|
+
}, Ye = {
|
|
2060
|
+
create: Xn
|
|
2061
|
+
}, Un = "#4dc4ff";
|
|
2062
|
+
function at(e, t, n, o, s, i, l, r) {
|
|
2060
2063
|
return {
|
|
2061
2064
|
x: e / 8 + n * 3 / 8 + s * 3 / 8 + l / 8,
|
|
2062
2065
|
y: t / 8 + o * 3 / 8 + i * 3 / 8 + r / 8
|
|
2063
2066
|
};
|
|
2064
2067
|
}
|
|
2065
|
-
function
|
|
2066
|
-
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(),
|
|
2068
|
+
function Jn(e, t, n) {
|
|
2069
|
+
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(), de(e));
|
|
2067
2070
|
}
|
|
2068
|
-
function
|
|
2071
|
+
function te(e, t, n, o, s) {
|
|
2069
2072
|
k(e, {
|
|
2070
2073
|
x1: t + "",
|
|
2071
2074
|
y1: n + "",
|
|
@@ -2073,15 +2076,15 @@ function ee(e, t, n, o, s) {
|
|
|
2073
2076
|
y2: s + ""
|
|
2074
2077
|
});
|
|
2075
2078
|
}
|
|
2076
|
-
function
|
|
2077
|
-
const
|
|
2078
|
-
if (e.line.setAttribute("d",
|
|
2079
|
+
function ze(e, t, n, o, s, i, l, r, c, a) {
|
|
2080
|
+
const h = `M ${t} ${n} C ${o} ${s} ${i} ${l} ${r} ${c}`;
|
|
2081
|
+
if (e.line.setAttribute("d", h), a.style) {
|
|
2079
2082
|
const p = a.style;
|
|
2080
2083
|
p.stroke && e.line.setAttribute("stroke", p.stroke), p.strokeWidth && e.line.setAttribute("stroke-width", String(p.strokeWidth)), p.strokeDasharray && e.line.setAttribute("stroke-dasharray", p.strokeDasharray), p.strokeLinecap && e.line.setAttribute("stroke-linecap", p.strokeLinecap), p.opacity !== void 0 && e.line.setAttribute("opacity", String(p.opacity));
|
|
2081
2084
|
}
|
|
2082
2085
|
const u = e.querySelectorAll('path[stroke="transparent"]');
|
|
2083
|
-
u.length > 0 && u[0].setAttribute("d",
|
|
2084
|
-
const g =
|
|
2086
|
+
u.length > 0 && u[0].setAttribute("d", h);
|
|
2087
|
+
const g = ie(i, l, r, c);
|
|
2085
2088
|
if (g) {
|
|
2086
2089
|
const p = `M ${g.x1} ${g.y1} L ${r} ${c} L ${g.x2} ${g.y2}`;
|
|
2087
2090
|
if (e.arrow1.setAttribute("d", p), u.length > 1 && u[1].setAttribute("d", p), a.style) {
|
|
@@ -2090,31 +2093,31 @@ function Ye(e, t, n, o, s, i, l, r, c, a) {
|
|
|
2090
2093
|
}
|
|
2091
2094
|
}
|
|
2092
2095
|
if (a.bidirectional) {
|
|
2093
|
-
const p =
|
|
2096
|
+
const p = ie(o, s, t, n);
|
|
2094
2097
|
if (p) {
|
|
2095
2098
|
const d = `M ${p.x1} ${p.y1} L ${t} ${n} L ${p.x2} ${p.y2}`;
|
|
2096
2099
|
if (e.arrow2.setAttribute("d", d), u.length > 2 && u[2].setAttribute("d", d), a.style) {
|
|
2097
|
-
const
|
|
2098
|
-
|
|
2100
|
+
const f = a.style;
|
|
2101
|
+
f.stroke && e.arrow2.setAttribute("stroke", f.stroke), f.strokeWidth && e.arrow2.setAttribute("stroke-width", String(f.strokeWidth)), f.strokeLinecap && e.arrow2.setAttribute("stroke-linecap", f.strokeLinecap), f.opacity !== void 0 && e.arrow2.setAttribute("opacity", String(f.opacity));
|
|
2099
2102
|
}
|
|
2100
2103
|
}
|
|
2101
2104
|
}
|
|
2102
|
-
const { x:
|
|
2103
|
-
if (e.labelEl &&
|
|
2105
|
+
const { x: v, y: m } = at(t, n, o, s, i, l, r, c);
|
|
2106
|
+
if (e.labelEl && Jn(e.labelEl, v, m), a.style?.labelColor) {
|
|
2104
2107
|
const p = e.labelEl;
|
|
2105
2108
|
p && (p.style.color = a.style.labelColor);
|
|
2106
2109
|
}
|
|
2107
|
-
|
|
2110
|
+
io(e);
|
|
2108
2111
|
}
|
|
2109
|
-
function
|
|
2110
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
2112
|
+
function ce(e, t, n) {
|
|
2113
|
+
const { offsetLeft: o, offsetTop: s } = $(e.nodes, t), i = t.offsetWidth, l = t.offsetHeight, r = o + i / 2, c = s + l / 2, a = r + n.x, h = c + n.y;
|
|
2111
2114
|
return {
|
|
2112
2115
|
w: i,
|
|
2113
2116
|
h: l,
|
|
2114
2117
|
cx: r,
|
|
2115
2118
|
cy: c,
|
|
2116
2119
|
ctrlX: a,
|
|
2117
|
-
ctrlY:
|
|
2120
|
+
ctrlY: h
|
|
2118
2121
|
};
|
|
2119
2122
|
}
|
|
2120
2123
|
function Y(e) {
|
|
@@ -2125,28 +2128,28 @@ function Y(e) {
|
|
|
2125
2128
|
y: n
|
|
2126
2129
|
};
|
|
2127
2130
|
}
|
|
2128
|
-
const
|
|
2131
|
+
const _e = function(e, t, n, o, s) {
|
|
2129
2132
|
if (!t || !n)
|
|
2130
2133
|
return;
|
|
2131
|
-
const i =
|
|
2134
|
+
const i = ce(e, t, o.delta1), l = ce(e, n, o.delta2), { x: r, y: c } = Y(i), { ctrlX: a, ctrlY: h } = i, { ctrlX: u, ctrlY: g } = l, { x: v, y: m } = Y(l), p = ie(u, g, v, m);
|
|
2132
2135
|
if (!p) return;
|
|
2133
|
-
const d = `M ${p.x1} ${p.y1} L ${
|
|
2134
|
-
let
|
|
2136
|
+
const d = `M ${p.x1} ${p.y1} L ${v} ${m} L ${p.x2} ${p.y2}`;
|
|
2137
|
+
let f = "";
|
|
2135
2138
|
if (o.bidirectional) {
|
|
2136
|
-
const
|
|
2137
|
-
if (!
|
|
2138
|
-
|
|
2139
|
+
const N = ie(a, h, r, c);
|
|
2140
|
+
if (!N) return;
|
|
2141
|
+
f = `M ${N.x1} ${N.y1} L ${r} ${c} L ${N.x2} ${N.y2}`;
|
|
2139
2142
|
}
|
|
2140
|
-
const
|
|
2141
|
-
|
|
2142
|
-
const
|
|
2143
|
+
const y = Lt(`M ${r} ${c} C ${a} ${h} ${u} ${g} ${v} ${m}`, d, f, o.style), { x: w, y: S } = at(r, c, a, h, u, g, v, m), E = o.style?.labelColor || "rgb(235, 95, 82)", x = "arrow-" + o.id;
|
|
2144
|
+
y.id = x;
|
|
2145
|
+
const b = e.markdown ? e.markdown(o.label, o) : o.label, C = ge(b, w, S, {
|
|
2143
2146
|
anchor: "middle",
|
|
2144
|
-
color:
|
|
2147
|
+
color: E,
|
|
2145
2148
|
dataType: "arrow",
|
|
2146
|
-
svgId:
|
|
2149
|
+
svgId: x
|
|
2147
2150
|
});
|
|
2148
|
-
|
|
2149
|
-
},
|
|
2151
|
+
y.labelEl = C, y.arrowObj = o, y.dataset.linkid = o.id, e.labelContainer.appendChild(C), e.linkSvgGroup.appendChild(y), de(C), s || (e.arrows.push(o), e.currentArrow = y, dt(e, o, i, l));
|
|
2152
|
+
}, Zn = function(e, t, n = {}) {
|
|
2150
2153
|
const o = {
|
|
2151
2154
|
id: W(),
|
|
2152
2155
|
label: "Custom Link",
|
|
@@ -2162,21 +2165,21 @@ const ke = function(e, t, n, o, s) {
|
|
|
2162
2165
|
},
|
|
2163
2166
|
...n
|
|
2164
2167
|
};
|
|
2165
|
-
|
|
2168
|
+
_e(this, e, t, o), this.bus.fire("operation", {
|
|
2166
2169
|
name: "createArrow",
|
|
2167
2170
|
obj: o
|
|
2168
2171
|
});
|
|
2169
|
-
},
|
|
2170
|
-
|
|
2172
|
+
}, Qn = function(e) {
|
|
2173
|
+
he(this);
|
|
2171
2174
|
const t = { ...e, id: W() };
|
|
2172
|
-
|
|
2175
|
+
_e(this, this.findEle(t.from), this.findEle(t.to), t), this.bus.fire("operation", {
|
|
2173
2176
|
name: "createArrow",
|
|
2174
2177
|
obj: t
|
|
2175
2178
|
});
|
|
2176
|
-
},
|
|
2179
|
+
}, eo = function(e) {
|
|
2177
2180
|
let t;
|
|
2178
2181
|
if (e ? t = e : t = this.currentArrow, !t) return;
|
|
2179
|
-
|
|
2182
|
+
he(this);
|
|
2180
2183
|
const n = t.arrowObj.id;
|
|
2181
2184
|
this.arrows = this.arrows.filter((o) => o.id !== n), t.remove(), this.bus.fire("operation", {
|
|
2182
2185
|
name: "removeArrow",
|
|
@@ -2184,14 +2187,14 @@ const ke = function(e, t, n, o, s) {
|
|
|
2184
2187
|
id: n
|
|
2185
2188
|
}
|
|
2186
2189
|
});
|
|
2187
|
-
},
|
|
2190
|
+
}, to = function(e) {
|
|
2188
2191
|
this.currentArrow = e;
|
|
2189
|
-
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s =
|
|
2190
|
-
|
|
2191
|
-
},
|
|
2192
|
-
|
|
2193
|
-
},
|
|
2194
|
-
const n = document.createElementNS(
|
|
2192
|
+
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s = ce(this, n, t.delta1), i = ce(this, o, t.delta2);
|
|
2193
|
+
dt(this, t, s, i);
|
|
2194
|
+
}, no = function() {
|
|
2195
|
+
he(this), this.currentArrow = null;
|
|
2196
|
+
}, fe = function(e, t) {
|
|
2197
|
+
const n = document.createElementNS(M, "path");
|
|
2195
2198
|
return k(n, {
|
|
2196
2199
|
d: e,
|
|
2197
2200
|
stroke: t,
|
|
@@ -2200,90 +2203,90 @@ const ke = function(e, t, n, o, s) {
|
|
|
2200
2203
|
"stroke-linecap": "round",
|
|
2201
2204
|
"stroke-linejoin": "round"
|
|
2202
2205
|
}), n;
|
|
2203
|
-
},
|
|
2204
|
-
const n = document.createElementNS(
|
|
2206
|
+
}, oo = function(e, t) {
|
|
2207
|
+
const n = document.createElementNS(M, "g");
|
|
2205
2208
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
2206
|
-
const o =
|
|
2209
|
+
const o = fe(e.line.getAttribute("d"), t);
|
|
2207
2210
|
n.appendChild(o);
|
|
2208
|
-
const s =
|
|
2211
|
+
const s = fe(e.arrow1.getAttribute("d"), t);
|
|
2209
2212
|
if (n.appendChild(s), e.arrow2.getAttribute("d")) {
|
|
2210
|
-
const i =
|
|
2213
|
+
const i = fe(e.arrow2.getAttribute("d"), t);
|
|
2211
2214
|
n.appendChild(i);
|
|
2212
2215
|
}
|
|
2213
2216
|
e.insertBefore(n, e.firstChild);
|
|
2214
|
-
},
|
|
2217
|
+
}, so = function(e) {
|
|
2215
2218
|
const t = e.querySelector(".arrow-highlight");
|
|
2216
2219
|
t && t.remove();
|
|
2217
|
-
},
|
|
2220
|
+
}, io = function(e) {
|
|
2218
2221
|
const t = e.querySelector(".arrow-highlight");
|
|
2219
2222
|
if (!t) return;
|
|
2220
2223
|
const n = t.querySelectorAll("path");
|
|
2221
2224
|
n.length >= 1 && n[0].setAttribute("d", e.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", e.arrow1.getAttribute("d")), n.length >= 3 && e.arrow2.getAttribute("d") && n[2].setAttribute("d", e.arrow2.getAttribute("d"));
|
|
2222
|
-
},
|
|
2223
|
-
e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow &&
|
|
2224
|
-
},
|
|
2225
|
-
const { linkController: s, P2: i, P3: l, line1: r, line2: c, nodes: a, map:
|
|
2225
|
+
}, he = function(e) {
|
|
2226
|
+
e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && so(e.currentArrow);
|
|
2227
|
+
}, dt = function(e, t, n, o) {
|
|
2228
|
+
const { linkController: s, P2: i, P3: l, line1: r, line2: c, nodes: a, map: h, currentArrow: u, bus: g } = e;
|
|
2226
2229
|
if (!u) return;
|
|
2227
|
-
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l),
|
|
2228
|
-
let { x:
|
|
2229
|
-
i.style.cssText = `top:${d}px;left:${p}px;`, l.style.cssText = `top:${
|
|
2230
|
-
p = p +
|
|
2231
|
-
const
|
|
2232
|
-
|
|
2233
|
-
}), e.helper2.init(
|
|
2234
|
-
|
|
2235
|
-
const
|
|
2236
|
-
|
|
2230
|
+
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l), oo(u, Un);
|
|
2231
|
+
let { x: v, y: m } = Y(n), { ctrlX: p, ctrlY: d } = n, { ctrlX: f, ctrlY: y } = o, { x: w, y: S } = Y(o);
|
|
2232
|
+
i.style.cssText = `top:${d}px;left:${p}px;`, l.style.cssText = `top:${y}px;left:${f}px;`, te(r, v, m, p, d), te(c, f, y, w, S), e.helper1 = Ye.create(i), e.helper2 = Ye.create(l), e.helper1.init(h, (E, x) => {
|
|
2233
|
+
p = p + E / e.scaleVal, d = d + x / e.scaleVal;
|
|
2234
|
+
const b = Y({ ...n, ctrlX: p, ctrlY: d });
|
|
2235
|
+
v = b.x, m = b.y, i.style.top = d + "px", i.style.left = p + "px", ze(u, v, m, p, d, f, y, w, S, t), te(r, v, m, p, d), t.delta1.x = p - n.cx, t.delta1.y = d - n.cy, g.fire("updateArrowDelta", t);
|
|
2236
|
+
}), e.helper2.init(h, (E, x) => {
|
|
2237
|
+
f = f + E / e.scaleVal, y = y + x / e.scaleVal;
|
|
2238
|
+
const b = Y({ ...o, ctrlX: f, ctrlY: y });
|
|
2239
|
+
w = b.x, S = b.y, l.style.top = y + "px", l.style.left = f + "px", ze(u, v, m, p, d, f, y, w, S, t), te(c, f, y, w, S), t.delta2.x = f - o.cx, t.delta2.y = y - o.cy, g.fire("updateArrowDelta", t);
|
|
2237
2240
|
});
|
|
2238
2241
|
};
|
|
2239
|
-
function
|
|
2242
|
+
function ro() {
|
|
2240
2243
|
this.linkSvgGroup.innerHTML = "";
|
|
2241
2244
|
for (let e = 0; e < this.arrows.length; e++) {
|
|
2242
2245
|
const t = this.arrows[e];
|
|
2243
2246
|
try {
|
|
2244
|
-
|
|
2247
|
+
_e(this, this.findEle(t.from), this.findEle(t.to), t, !0);
|
|
2245
2248
|
} catch {
|
|
2246
2249
|
}
|
|
2247
2250
|
}
|
|
2248
2251
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
2249
2252
|
}
|
|
2250
|
-
function
|
|
2251
|
-
|
|
2253
|
+
function lo(e) {
|
|
2254
|
+
he(this), e && e.labelEl && Qe(this, e.labelEl, e.arrowObj);
|
|
2252
2255
|
}
|
|
2253
|
-
function
|
|
2254
|
-
this.arrows = this.arrows.filter((e) =>
|
|
2256
|
+
function co() {
|
|
2257
|
+
this.arrows = this.arrows.filter((e) => se(e.from, this.nodeData) && se(e.to, this.nodeData));
|
|
2255
2258
|
}
|
|
2256
|
-
const
|
|
2259
|
+
const ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2257
2260
|
__proto__: null,
|
|
2258
|
-
createArrow:
|
|
2259
|
-
createArrowFrom:
|
|
2260
|
-
editArrowLabel:
|
|
2261
|
-
removeArrow:
|
|
2262
|
-
renderArrow:
|
|
2263
|
-
selectArrow:
|
|
2264
|
-
tidyArrow:
|
|
2265
|
-
unselectArrow:
|
|
2266
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2261
|
+
createArrow: Zn,
|
|
2262
|
+
createArrowFrom: Qn,
|
|
2263
|
+
editArrowLabel: lo,
|
|
2264
|
+
removeArrow: eo,
|
|
2265
|
+
renderArrow: ro,
|
|
2266
|
+
selectArrow: to,
|
|
2267
|
+
tidyArrow: co,
|
|
2268
|
+
unselectArrow: no
|
|
2269
|
+
}, Symbol.toStringTag, { value: "Module" })), ho = function(e) {
|
|
2267
2270
|
if (e.length === 0) throw new Error("No selected node.");
|
|
2268
2271
|
if (e.length === 1) {
|
|
2269
2272
|
const c = e[0].nodeObj, a = e[0].nodeObj.parent;
|
|
2270
2273
|
if (!a) throw new Error("Can not select root node.");
|
|
2271
|
-
const
|
|
2274
|
+
const h = a.children.findIndex((u) => c === u);
|
|
2272
2275
|
return {
|
|
2273
2276
|
parent: a.id,
|
|
2274
|
-
start:
|
|
2275
|
-
end:
|
|
2277
|
+
start: h,
|
|
2278
|
+
end: h
|
|
2276
2279
|
};
|
|
2277
2280
|
}
|
|
2278
2281
|
let t = 0;
|
|
2279
2282
|
const n = e.map((c) => {
|
|
2280
2283
|
let a = c.nodeObj;
|
|
2281
|
-
const
|
|
2284
|
+
const h = [];
|
|
2282
2285
|
for (; a.parent; ) {
|
|
2283
|
-
const u = a.parent,
|
|
2284
|
-
a = u,
|
|
2286
|
+
const u = a.parent, v = u.children?.indexOf(a);
|
|
2287
|
+
a = u, h.unshift({ node: a, index: v });
|
|
2285
2288
|
}
|
|
2286
|
-
return
|
|
2289
|
+
return h.length > t && (t = h.length), h;
|
|
2287
2290
|
});
|
|
2288
2291
|
let o = 0;
|
|
2289
2292
|
e: for (; o < t; o++) {
|
|
@@ -2300,11 +2303,11 @@ const co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2300
2303
|
start: i,
|
|
2301
2304
|
end: l
|
|
2302
2305
|
};
|
|
2303
|
-
},
|
|
2304
|
-
const t = document.createElementNS(
|
|
2306
|
+
}, fo = function(e) {
|
|
2307
|
+
const t = document.createElementNS(M, "g");
|
|
2305
2308
|
return t.setAttribute("id", e), t;
|
|
2306
|
-
},
|
|
2307
|
-
const n = document.createElementNS(
|
|
2309
|
+
}, qe = function(e, t) {
|
|
2310
|
+
const n = document.createElementNS(M, "path");
|
|
2308
2311
|
return k(n, {
|
|
2309
2312
|
d: e,
|
|
2310
2313
|
stroke: t || "#666",
|
|
@@ -2312,69 +2315,69 @@ const co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2312
2315
|
"stroke-linecap": "round",
|
|
2313
2316
|
"stroke-width": "2"
|
|
2314
2317
|
}), n;
|
|
2315
|
-
},
|
|
2318
|
+
}, uo = (e) => e.parentElement.parentElement, po = function(e, { parent: t, start: n }) {
|
|
2316
2319
|
const o = e.findEle(t), s = o.nodeObj;
|
|
2317
2320
|
let i;
|
|
2318
2321
|
return s.parent ? i = o.closest("me-main").className : i = e.findEle(s.children[n].id).closest("me-main").className, i;
|
|
2319
|
-
},
|
|
2320
|
-
const { id: n, label: o, parent: s, start: i, end: l, style: r } = t, { nodes: c, theme: a, summarySvg:
|
|
2321
|
-
let m = 1 / 0, p = 0, d = 0,
|
|
2322
|
-
for (let
|
|
2323
|
-
const
|
|
2324
|
-
if (!
|
|
2322
|
+
}, Te = function(e, t) {
|
|
2323
|
+
const { id: n, label: o, parent: s, start: i, end: l, style: r } = t, { nodes: c, theme: a, summarySvg: h } = e, g = e.findEle(s).nodeObj, v = po(e, t);
|
|
2324
|
+
let m = 1 / 0, p = 0, d = 0, f = 0;
|
|
2325
|
+
for (let X = i; X <= l; X++) {
|
|
2326
|
+
const Le = g.children?.[X];
|
|
2327
|
+
if (!Le)
|
|
2325
2328
|
return e.removeSummary(n), null;
|
|
2326
|
-
const
|
|
2327
|
-
|
|
2328
|
-
}
|
|
2329
|
-
let
|
|
2330
|
-
const
|
|
2331
|
-
|
|
2332
|
-
const
|
|
2333
|
-
return
|
|
2334
|
-
},
|
|
2329
|
+
const Z = uo(e.findEle(Le.id)), { offsetLeft: Q, offsetTop: Ae } = $(c, Z), Me = i === l ? 10 : 20;
|
|
2330
|
+
X === i && (d = Ae + Me), X === l && (f = Ae + Z.offsetHeight - Me), Q < m && (m = Q), Z.offsetWidth + Q > p && (p = Z.offsetWidth + Q);
|
|
2331
|
+
}
|
|
2332
|
+
let y, w;
|
|
2333
|
+
const S = g.parent ? 10 : 0, E = d + S, x = f + S, b = (E + x) / 2, C = r?.stroke || a.cssVar["--color"], N = r?.labelColor || a.cssVar["--color"], L = "s-" + n, O = e.markdown ? e.markdown(o, t) : o;
|
|
2334
|
+
v === D.LHS ? (y = qe(`M ${m + 10} ${E} c -5 0 -10 5 -10 10 L ${m} ${x - 10} c 0 5 5 10 10 10 M ${m} ${b} h -10`, C), w = ge(O, m - 20, b, { anchor: "end", color: N, dataType: "summary", svgId: L })) : (y = qe(`M ${p - 10} ${E} c 5 0 10 5 10 10 L ${p} ${x - 10} c 0 5 -5 10 -10 10 M ${p} ${b} h 10`, C), w = ge(O, p + 20, b, { anchor: "start", color: N, dataType: "summary", svgId: L }));
|
|
2335
|
+
const j = fo(L);
|
|
2336
|
+
return j.appendChild(y), e.labelContainer.appendChild(w), de(w), j.summaryObj = t, j.labelEl = w, h.appendChild(j), j;
|
|
2337
|
+
}, go = function(e = {}) {
|
|
2335
2338
|
if (!this.currentNodes) return;
|
|
2336
|
-
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } =
|
|
2339
|
+
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } = ho(t), r = { id: W(), parent: s, start: i, end: l, label: "summary", style: e.style }, c = Te(this, r);
|
|
2337
2340
|
n.push(r), this.editSummary(c), o.fire("operation", {
|
|
2338
2341
|
name: "createSummary",
|
|
2339
2342
|
obj: r
|
|
2340
2343
|
});
|
|
2341
|
-
},
|
|
2344
|
+
}, mo = function(e) {
|
|
2342
2345
|
const t = W(), n = { ...e, id: t };
|
|
2343
|
-
|
|
2346
|
+
Te(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
2344
2347
|
name: "createSummary",
|
|
2345
2348
|
obj: n
|
|
2346
2349
|
});
|
|
2347
|
-
},
|
|
2350
|
+
}, yo = function(e) {
|
|
2348
2351
|
const t = this.summaries.findIndex((n) => n.id === e);
|
|
2349
2352
|
t > -1 && (this.summaries.splice(t, 1), this.nodes.querySelector("#s-" + e)?.remove(), this.nodes.querySelector("#label-s-" + e)?.remove()), this.bus.fire("operation", {
|
|
2350
2353
|
name: "removeSummary",
|
|
2351
2354
|
obj: { id: e }
|
|
2352
2355
|
});
|
|
2353
|
-
},
|
|
2356
|
+
}, vo = function(e) {
|
|
2354
2357
|
const t = e.labelEl;
|
|
2355
2358
|
t && t.classList.add("selected"), this.currentSummary = e;
|
|
2356
|
-
}, vo = function() {
|
|
2357
|
-
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
|
|
2358
2359
|
}, bo = function() {
|
|
2360
|
+
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
|
|
2361
|
+
}, wo = function() {
|
|
2359
2362
|
this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
|
|
2360
2363
|
try {
|
|
2361
|
-
|
|
2364
|
+
Te(this, e);
|
|
2362
2365
|
} catch {
|
|
2363
2366
|
}
|
|
2364
2367
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
2365
|
-
},
|
|
2366
|
-
e && e.labelEl &&
|
|
2367
|
-
},
|
|
2368
|
+
}, xo = function(e) {
|
|
2369
|
+
e && e.labelEl && Qe(this, e.labelEl, e.summaryObj);
|
|
2370
|
+
}, Eo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2368
2371
|
__proto__: null,
|
|
2369
|
-
createSummary:
|
|
2370
|
-
createSummaryFrom:
|
|
2371
|
-
editSummary:
|
|
2372
|
-
removeSummary:
|
|
2373
|
-
renderSummary:
|
|
2374
|
-
selectSummary:
|
|
2375
|
-
unselectSummary:
|
|
2372
|
+
createSummary: go,
|
|
2373
|
+
createSummaryFrom: mo,
|
|
2374
|
+
editSummary: xo,
|
|
2375
|
+
removeSummary: yo,
|
|
2376
|
+
renderSummary: wo,
|
|
2377
|
+
selectSummary: vo,
|
|
2378
|
+
unselectSummary: bo
|
|
2376
2379
|
}, Symbol.toStringTag, { value: "Module" })), T = "http://www.w3.org/2000/svg";
|
|
2377
|
-
function
|
|
2380
|
+
function Co(e, t) {
|
|
2378
2381
|
const n = document.createElementNS(T, "svg");
|
|
2379
2382
|
return k(n, {
|
|
2380
2383
|
version: "1.1",
|
|
@@ -2383,10 +2386,10 @@ function Eo(e, t) {
|
|
|
2383
2386
|
width: t
|
|
2384
2387
|
}), n;
|
|
2385
2388
|
}
|
|
2386
|
-
function
|
|
2389
|
+
function So(e, t) {
|
|
2387
2390
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2388
2391
|
}
|
|
2389
|
-
function
|
|
2392
|
+
function No(e, t, n, o) {
|
|
2390
2393
|
const s = document.createElementNS(T, "g");
|
|
2391
2394
|
let i = "";
|
|
2392
2395
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
@@ -2394,7 +2397,7 @@ function So(e, t, n, o) {
|
|
|
2394
2397
|
const a = document.createElementNS(T, "text");
|
|
2395
2398
|
k(a, {
|
|
2396
2399
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2397
|
-
y: o + parseInt(t.paddingTop) +
|
|
2400
|
+
y: o + parseInt(t.paddingTop) + So(t.lineHeight, t.fontSize) * (c + 1) + parseFloat(t.fontSize) * (c + 1) + "",
|
|
2398
2401
|
"text-anchor": "start",
|
|
2399
2402
|
"font-family": t.fontFamily,
|
|
2400
2403
|
"font-size": `${t.fontSize}`,
|
|
@@ -2403,7 +2406,7 @@ function So(e, t, n, o) {
|
|
|
2403
2406
|
}), a.innerHTML = r, s.appendChild(a);
|
|
2404
2407
|
}), s;
|
|
2405
2408
|
}
|
|
2406
|
-
function
|
|
2409
|
+
function ko(e, t, n, o) {
|
|
2407
2410
|
let s = "";
|
|
2408
2411
|
e.nodeObj?.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
2409
2412
|
const i = document.createElementNS(T, "foreignObject");
|
|
@@ -2419,8 +2422,8 @@ function No(e, t, n, o) {
|
|
|
2419
2422
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
2420
2423
|
}), l.innerHTML = s, i.appendChild(l), i;
|
|
2421
2424
|
}
|
|
2422
|
-
function
|
|
2423
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2425
|
+
function _o(e, t) {
|
|
2426
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = $(e.nodes, t), i = document.createElementNS(T, "rect");
|
|
2424
2427
|
return k(i, {
|
|
2425
2428
|
x: o + "",
|
|
2426
2429
|
y: s + "",
|
|
@@ -2433,8 +2436,8 @@ function ko(e, t) {
|
|
|
2433
2436
|
"stroke-width": n.borderWidth
|
|
2434
2437
|
}), i;
|
|
2435
2438
|
}
|
|
2436
|
-
function
|
|
2437
|
-
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } =
|
|
2439
|
+
function ne(e, t, n = !1) {
|
|
2440
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = $(e.nodes, t), l = document.createElementNS(T, "rect");
|
|
2438
2441
|
k(l, {
|
|
2439
2442
|
x: s + "",
|
|
2440
2443
|
y: i + "",
|
|
@@ -2449,10 +2452,10 @@ function te(e, t, n = !1) {
|
|
|
2449
2452
|
const r = document.createElementNS(T, "g");
|
|
2450
2453
|
r.appendChild(l);
|
|
2451
2454
|
let c;
|
|
2452
|
-
return n ? c =
|
|
2455
|
+
return n ? c = ko(t, o, s, i) : c = No(t, o, s, i), r.appendChild(c), r;
|
|
2453
2456
|
}
|
|
2454
|
-
function
|
|
2455
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2457
|
+
function To(e, t) {
|
|
2458
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = $(e.nodes, t), i = document.createElementNS(T, "a"), l = document.createElementNS(T, "text");
|
|
2456
2459
|
return k(l, {
|
|
2457
2460
|
x: o + "",
|
|
2458
2461
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -2463,8 +2466,8 @@ function _o(e, t) {
|
|
|
2463
2466
|
fill: `${n.color}`
|
|
2464
2467
|
}), l.innerHTML = t.textContent, i.appendChild(l), i.setAttribute("href", t.href), i;
|
|
2465
2468
|
}
|
|
2466
|
-
function
|
|
2467
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2469
|
+
function Lo(e, t) {
|
|
2470
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = $(e.nodes, t), i = document.createElementNS(T, "image");
|
|
2468
2471
|
return k(i, {
|
|
2469
2472
|
x: o + "",
|
|
2470
2473
|
y: s + "",
|
|
@@ -2473,8 +2476,8 @@ function To(e, t) {
|
|
|
2473
2476
|
href: t.src
|
|
2474
2477
|
}), i;
|
|
2475
2478
|
}
|
|
2476
|
-
const
|
|
2477
|
-
const n = e.nodes, o = n.offsetHeight +
|
|
2479
|
+
const oe = 100, Ao = '<?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">', Mo = (e, t = !1) => {
|
|
2480
|
+
const n = e.nodes, o = n.offsetHeight + oe * 2, s = n.offsetWidth + oe * 2, i = Co(o + "px", s + "px"), l = document.createElementNS(T, "svg"), r = document.createElementNS(T, "rect");
|
|
2478
2481
|
k(r, {
|
|
2479
2482
|
x: "0",
|
|
2480
2483
|
y: "0",
|
|
@@ -2482,31 +2485,31 @@ const ne = 100, Lo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2482
2485
|
height: `${o}`,
|
|
2483
2486
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2484
2487
|
}), i.appendChild(r), n.querySelectorAll(".subLines").forEach((u) => {
|
|
2485
|
-
const g = u.cloneNode(!0), { offsetLeft:
|
|
2486
|
-
g.setAttribute("x", `${
|
|
2488
|
+
const g = u.cloneNode(!0), { offsetLeft: v, offsetTop: m } = $(n, u.parentElement);
|
|
2489
|
+
g.setAttribute("x", `${v}`), g.setAttribute("y", `${m}`), l.appendChild(g);
|
|
2487
2490
|
});
|
|
2488
2491
|
const c = n.querySelector(".lines")?.cloneNode(!0);
|
|
2489
2492
|
c && l.appendChild(c);
|
|
2490
2493
|
const a = n.querySelector(".topiclinks")?.cloneNode(!0);
|
|
2491
2494
|
a && l.appendChild(a);
|
|
2492
|
-
const
|
|
2493
|
-
return
|
|
2494
|
-
u.nodeObj.dangerouslySetInnerHTML ? l.appendChild(
|
|
2495
|
+
const h = n.querySelector(".summary")?.cloneNode(!0);
|
|
2496
|
+
return h && l.appendChild(h), n.querySelectorAll("me-tpc").forEach((u) => {
|
|
2497
|
+
u.nodeObj.dangerouslySetInnerHTML ? l.appendChild(ne(e, u, !t)) : (l.appendChild(_o(e, u)), l.appendChild(ne(e, u.text, !t)));
|
|
2495
2498
|
}), n.querySelectorAll(".tags > span").forEach((u) => {
|
|
2496
|
-
l.appendChild(
|
|
2499
|
+
l.appendChild(ne(e, u));
|
|
2497
2500
|
}), n.querySelectorAll(".icons > span").forEach((u) => {
|
|
2498
|
-
l.appendChild(
|
|
2501
|
+
l.appendChild(ne(e, u));
|
|
2499
2502
|
}), n.querySelectorAll(".hyper-link").forEach((u) => {
|
|
2500
|
-
l.appendChild(_o(e, u));
|
|
2501
|
-
}), n.querySelectorAll("img").forEach((u) => {
|
|
2502
2503
|
l.appendChild(To(e, u));
|
|
2504
|
+
}), n.querySelectorAll("img").forEach((u) => {
|
|
2505
|
+
l.appendChild(Lo(e, u));
|
|
2503
2506
|
}), k(l, {
|
|
2504
|
-
x:
|
|
2505
|
-
y:
|
|
2507
|
+
x: oe + "",
|
|
2508
|
+
y: oe + "",
|
|
2506
2509
|
overflow: "visible"
|
|
2507
2510
|
}), i.appendChild(l), i;
|
|
2508
|
-
},
|
|
2509
|
-
function
|
|
2511
|
+
}, Do = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Ao + e.outerHTML);
|
|
2512
|
+
function Po(e) {
|
|
2510
2513
|
return new Promise((t, n) => {
|
|
2511
2514
|
const o = new FileReader();
|
|
2512
2515
|
o.onload = (s) => {
|
|
@@ -2516,11 +2519,11 @@ function Do(e) {
|
|
|
2516
2519
|
}, o.readAsDataURL(e);
|
|
2517
2520
|
});
|
|
2518
2521
|
}
|
|
2519
|
-
const
|
|
2520
|
-
const n =
|
|
2522
|
+
const $o = function(e = !1, t) {
|
|
2523
|
+
const n = Mo(this, e), o = Do(n, t);
|
|
2521
2524
|
return new Blob([o], { type: "image/svg+xml" });
|
|
2522
|
-
},
|
|
2523
|
-
const n = this.exportSvg(e, t), o = await
|
|
2525
|
+
}, Oo = async function(e = !1, t) {
|
|
2526
|
+
const n = this.exportSvg(e, t), o = await Po(n);
|
|
2524
2527
|
return new Promise((s, i) => {
|
|
2525
2528
|
const l = new Image();
|
|
2526
2529
|
l.setAttribute("crossOrigin", "anonymous"), l.onload = () => {
|
|
@@ -2528,66 +2531,66 @@ const Po = function(e = !1, t) {
|
|
|
2528
2531
|
r.width = l.width, r.height = l.height, r.getContext("2d").drawImage(l, 0, 0), r.toBlob(s, "image/png", 1);
|
|
2529
2532
|
}, l.src = o, l.onerror = i;
|
|
2530
2533
|
});
|
|
2531
|
-
},
|
|
2534
|
+
}, jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2532
2535
|
__proto__: null,
|
|
2533
|
-
exportPng:
|
|
2534
|
-
exportSvg:
|
|
2536
|
+
exportPng: Oo,
|
|
2537
|
+
exportSvg: $o
|
|
2535
2538
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2536
|
-
function
|
|
2539
|
+
function Ho(e, t) {
|
|
2537
2540
|
return async function(...n) {
|
|
2538
2541
|
const o = this.before[t];
|
|
2539
2542
|
o && !await o.apply(this, n) || e.apply(this, n);
|
|
2540
2543
|
};
|
|
2541
2544
|
}
|
|
2542
|
-
const
|
|
2543
|
-
for (let e = 0; e <
|
|
2544
|
-
const t =
|
|
2545
|
-
|
|
2545
|
+
const Ve = Object.keys(lt), ht = {};
|
|
2546
|
+
for (let e = 0; e < Ve.length; e++) {
|
|
2547
|
+
const t = Ve[e];
|
|
2548
|
+
ht[t] = Ho(lt[t], t);
|
|
2546
2549
|
}
|
|
2547
|
-
const
|
|
2548
|
-
getObjById:
|
|
2549
|
-
generateNewObj:
|
|
2550
|
-
layout:
|
|
2551
|
-
linkDiv:
|
|
2552
|
-
editTopic:
|
|
2553
|
-
createWrapper:
|
|
2554
|
-
createParent:
|
|
2555
|
-
createChildren:
|
|
2556
|
-
createTopic:
|
|
2557
|
-
findEle:
|
|
2558
|
-
changeTheme:
|
|
2559
|
-
...
|
|
2560
|
-
...
|
|
2561
|
-
...
|
|
2562
|
-
...
|
|
2563
|
-
...
|
|
2550
|
+
const Bo = {
|
|
2551
|
+
getObjById: se,
|
|
2552
|
+
generateNewObj: ft,
|
|
2553
|
+
layout: xt,
|
|
2554
|
+
linkDiv: At,
|
|
2555
|
+
editTopic: Tt,
|
|
2556
|
+
createWrapper: St,
|
|
2557
|
+
createParent: Nt,
|
|
2558
|
+
createChildren: kt,
|
|
2559
|
+
createTopic: _t,
|
|
2560
|
+
findEle: Ue,
|
|
2561
|
+
changeTheme: nn,
|
|
2562
|
+
...Vn,
|
|
2563
|
+
...ht,
|
|
2564
|
+
...ao,
|
|
2565
|
+
...Eo,
|
|
2566
|
+
...jo,
|
|
2564
2567
|
init(e) {
|
|
2565
2568
|
if (e = JSON.parse(JSON.stringify(e)), !e || !e.nodeData) return new Error("MindElixir: `data` is required");
|
|
2566
|
-
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, R(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar &&
|
|
2569
|
+
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, R(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && Vt(this), this.keypress && vt(this, this.keypress), this.editable && tn(this), this.contextMenu && this.disposable.push(Mt(this, this.contextMenu)), this.draggable && this.disposable.push(Ot(this)), this.allowUndo && this.disposable.push(Ht(this)), this.layout(), this.linkDiv(), this.toCenter();
|
|
2567
2570
|
},
|
|
2568
2571
|
destroy() {
|
|
2569
2572
|
this.disposable.forEach((e) => e()), this.el && (this.el.innerHTML = ""), this.el = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.waitCopy = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, this.selection?.destroy(), this.selection = void 0;
|
|
2570
2573
|
}
|
|
2571
2574
|
};
|
|
2572
|
-
function
|
|
2573
|
-
let
|
|
2575
|
+
function Ro({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: r, direction: c, containerHeight: a }) {
|
|
2576
|
+
let h = t + n / 2;
|
|
2574
2577
|
const u = e + o / 2;
|
|
2575
2578
|
let g;
|
|
2576
|
-
c ===
|
|
2577
|
-
const
|
|
2578
|
-
return c ===
|
|
2579
|
+
c === D.LHS ? g = i + l : g = i;
|
|
2580
|
+
const v = s + r / 2, p = (1 - Math.abs(v - u) / a) * 0.25 * (n / 2);
|
|
2581
|
+
return c === D.LHS ? h = h - n / 10 - p : h = h + n / 10 + p, `M ${h} ${u} Q ${h} ${v} ${g} ${v}`;
|
|
2579
2582
|
}
|
|
2580
|
-
function
|
|
2581
|
-
const
|
|
2583
|
+
function Io({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: r, direction: c, isFirst: a }) {
|
|
2584
|
+
const h = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
2582
2585
|
let u = 0, g = 0;
|
|
2583
2586
|
a ? u = e + o / 2 : u = e + o;
|
|
2584
|
-
const
|
|
2587
|
+
const v = s + r;
|
|
2585
2588
|
let m = 0, p = 0, d = 0;
|
|
2586
|
-
const
|
|
2587
|
-
return c ===
|
|
2589
|
+
const f = Math.abs(u - v) / 300 * h;
|
|
2590
|
+
return c === D.LHS ? (d = t, m = d + h, p = d - h, g = i + h, `M ${m} ${u} C ${d} ${u} ${d + f} ${v} ${p} ${v} H ${g}`) : (d = t + n, m = d - h, p = d + h, g = i + l - h, `M ${m} ${u} C ${d} ${u} ${d - f} ${v} ${p} ${v} H ${g}`);
|
|
2588
2591
|
}
|
|
2589
|
-
const
|
|
2590
|
-
function
|
|
2592
|
+
const Fo = "5.3.5";
|
|
2593
|
+
function Wo(e) {
|
|
2591
2594
|
return {
|
|
2592
2595
|
x: 0,
|
|
2593
2596
|
y: 0,
|
|
@@ -2603,7 +2606,7 @@ function Fo(e) {
|
|
|
2603
2606
|
};
|
|
2604
2607
|
}
|
|
2605
2608
|
const G = document;
|
|
2606
|
-
function
|
|
2609
|
+
function P({
|
|
2607
2610
|
el: e,
|
|
2608
2611
|
direction: t,
|
|
2609
2612
|
locale: n,
|
|
@@ -2614,45 +2617,45 @@ function $({
|
|
|
2614
2617
|
keypress: r,
|
|
2615
2618
|
mouseSelectionButton: c,
|
|
2616
2619
|
selectionContainer: a,
|
|
2617
|
-
before:
|
|
2620
|
+
before: h,
|
|
2618
2621
|
newTopicName: u,
|
|
2619
2622
|
allowUndo: g,
|
|
2620
|
-
generateMainBranch:
|
|
2623
|
+
generateMainBranch: v,
|
|
2621
2624
|
generateSubBranch: m,
|
|
2622
2625
|
overflowHidden: p,
|
|
2623
2626
|
theme: d,
|
|
2624
|
-
alignment:
|
|
2625
|
-
scaleSensitivity:
|
|
2626
|
-
scaleMax:
|
|
2627
|
-
scaleMin:
|
|
2628
|
-
handleWheel:
|
|
2629
|
-
markdown:
|
|
2630
|
-
imageProxy:
|
|
2627
|
+
alignment: f,
|
|
2628
|
+
scaleSensitivity: y,
|
|
2629
|
+
scaleMax: w,
|
|
2630
|
+
scaleMin: S,
|
|
2631
|
+
handleWheel: E,
|
|
2632
|
+
markdown: x,
|
|
2633
|
+
imageProxy: b
|
|
2631
2634
|
}) {
|
|
2632
2635
|
let C = null;
|
|
2633
2636
|
const N = Object.prototype.toString.call(e);
|
|
2634
2637
|
if (N === "[object HTMLDivElement]" ? C = e : N === "[object String]" && (C = document.querySelector(e)), !C) throw new Error("MindElixir: el is not a valid element");
|
|
2635
|
-
C.style.position = "relative", C.innerHTML = "", this.el = C, this.disposable = [], this.before =
|
|
2638
|
+
C.style.position = "relative", C.innerHTML = "", this.el = C, this.disposable = [], this.before = h || {}, 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 = y ?? 0.1, this.scaleMax = w ?? 1.4, this.scaleMin = S ?? 0.2, this.generateMainBranch = v || Ro, this.generateSubBranch = m || Io, this.overflowHidden = p ?? !1, this.alignment = f ?? "root", this.handleWheel = E ?? !0, this.markdown = x || void 0, this.imageProxy = b || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = Wo(this), this.bus = wt(), this.container = G.createElement("div"), this.selectionContainer = a || this.container, this.container.className = "map-container";
|
|
2636
2639
|
const L = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2637
|
-
this.theme = d || (L.matches ?
|
|
2638
|
-
const
|
|
2639
|
-
|
|
2640
|
+
this.theme = d || (L.matches ? we : be);
|
|
2641
|
+
const O = G.createElement("div");
|
|
2642
|
+
O.className = "map-canvas", this.map = O, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = G.createElement("me-nodes"), this.lines = U("lines"), this.summarySvg = U("summary"), this.linkController = U("linkcontroller"), this.P2 = G.createElement("div"), this.P3 = G.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = $e(), this.line2 = $e(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = U("topiclinks"), this.labelContainer = G.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(bt(this));
|
|
2640
2643
|
}
|
|
2641
|
-
|
|
2642
|
-
Object.defineProperty(
|
|
2644
|
+
P.prototype = Bo;
|
|
2645
|
+
Object.defineProperty(P.prototype, "currentNode", {
|
|
2643
2646
|
get() {
|
|
2644
2647
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
2645
2648
|
},
|
|
2646
2649
|
enumerable: !0
|
|
2647
2650
|
});
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2651
|
+
P.LEFT = 0;
|
|
2652
|
+
P.RIGHT = 1;
|
|
2653
|
+
P.SIDE = 2;
|
|
2654
|
+
P.THEME = be;
|
|
2655
|
+
P.DARK_THEME = we;
|
|
2656
|
+
P.version = Fo;
|
|
2657
|
+
P.E = Ue;
|
|
2658
|
+
P.new = (e) => ({
|
|
2656
2659
|
nodeData: {
|
|
2657
2660
|
id: W(),
|
|
2658
2661
|
topic: e || "new topic",
|
|
@@ -2660,5 +2663,5 @@ $.new = (e) => ({
|
|
|
2660
2663
|
}
|
|
2661
2664
|
});
|
|
2662
2665
|
export {
|
|
2663
|
-
|
|
2666
|
+
P as default
|
|
2664
2667
|
};
|