mind-elixir 5.3.2 → 5.3.4
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 +5 -4
- package/dist/MindElixir.js +663 -659
- package/dist/MindElixirLite.css +1 -1
- package/dist/MindElixirLite.iife.js +5 -4
- package/dist/MindElixirLite.js +384 -380
- 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;
|
|
@@ -69,47 +69,47 @@ const oe = function(e, t) {
|
|
|
69
69
|
if (e.parent = t, e.children)
|
|
70
70
|
for (let n = 0; n < e.children.length; n++)
|
|
71
71
|
R(e.children[n], e);
|
|
72
|
-
},
|
|
72
|
+
}, z = (e, t, n) => {
|
|
73
73
|
if (e.expanded = t, e.children)
|
|
74
74
|
if (n === void 0 || n > 0) {
|
|
75
75
|
const o = n !== void 0 ? n - 1 : void 0;
|
|
76
76
|
e.children.forEach((s) => {
|
|
77
|
-
|
|
77
|
+
z(s, t, o);
|
|
78
78
|
});
|
|
79
79
|
} else
|
|
80
80
|
e.children.forEach((o) => {
|
|
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);
|
|
@@ -200,13 +200,13 @@ function yt(e, t) {
|
|
|
200
200
|
const c = e.nodeData;
|
|
201
201
|
if (r.key === "0")
|
|
202
202
|
for (const a of c.children)
|
|
203
|
-
|
|
203
|
+
z(a, !1);
|
|
204
204
|
if (r.key === "=")
|
|
205
205
|
for (const a of c.children)
|
|
206
|
-
|
|
206
|
+
z(a, !0);
|
|
207
207
|
if (["1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(r.key))
|
|
208
208
|
for (const a of c.children)
|
|
209
|
-
|
|
209
|
+
z(a, !0, Number(r.key) - 1);
|
|
210
210
|
e.refresh(), e.toCenter(), o = !1, s && (clearTimeout(s), s = null, e.container.removeEventListener("keydown", i));
|
|
211
211
|
}, l = {
|
|
212
212
|
Enter: (r) => {
|
|
@@ -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";
|
|
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 = `
|
|
@@ -545,11 +548,12 @@ const _t = function(e) {
|
|
|
545
548
|
top: ${i}px;
|
|
546
549
|
min-width:${e.offsetWidth - 8}px;
|
|
547
550
|
color:${l.color};
|
|
551
|
+
font-size:${l.fontSize};
|
|
548
552
|
padding:${l.padding};
|
|
549
553
|
margin:${l.margin};
|
|
550
554
|
background-color:${l.backgroundColor !== "rgba(0, 0, 0, 0)" && l.backgroundColor};
|
|
551
555
|
border: ${l.border};
|
|
552
|
-
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", {
|
|
553
557
|
name: "beginEdit",
|
|
554
558
|
obj: e.nodeObj
|
|
555
559
|
}), t.addEventListener("keydown", (r) => {
|
|
@@ -569,34 +573,34 @@ const _t = function(e) {
|
|
|
569
573
|
origin: o
|
|
570
574
|
}));
|
|
571
575
|
});
|
|
572
|
-
},
|
|
576
|
+
}, Ne = function(e) {
|
|
573
577
|
const t = _.createElement("me-epd");
|
|
574
578
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
575
|
-
},
|
|
579
|
+
}, q = document, M = "http://www.w3.org/2000/svg", de = function(e) {
|
|
576
580
|
const t = e.clientWidth, n = e.clientHeight, o = e.dataset, s = Number(o.x), i = Number(o.y), l = o.anchor;
|
|
577
581
|
let r = s;
|
|
578
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";
|
|
579
|
-
},
|
|
583
|
+
}, ge = function(e, t, n, o) {
|
|
580
584
|
const { anchor: s = "middle", color: i, dataType: l, svgId: r } = o, c = document.createElement("div");
|
|
581
585
|
c.className = "svg-label", c.style.color = i || "#666";
|
|
582
586
|
const a = "label-" + r;
|
|
583
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;
|
|
584
|
-
},
|
|
585
|
-
const o =
|
|
588
|
+
}, Ze = function(e, t, n) {
|
|
589
|
+
const o = q.createElementNS(M, "path");
|
|
586
590
|
return k(o, {
|
|
587
591
|
d: e,
|
|
588
592
|
stroke: t || "#666",
|
|
589
593
|
fill: "none",
|
|
590
594
|
"stroke-width": n
|
|
591
595
|
}), o;
|
|
592
|
-
},
|
|
593
|
-
const t =
|
|
596
|
+
}, U = function(e) {
|
|
597
|
+
const t = q.createElementNS(M, "svg");
|
|
594
598
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
595
|
-
},
|
|
596
|
-
const e =
|
|
599
|
+
}, $e = function() {
|
|
600
|
+
const e = q.createElementNS(M, "line");
|
|
597
601
|
return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
|
|
598
|
-
},
|
|
599
|
-
const s =
|
|
602
|
+
}, Lt = function(e, t, n, o) {
|
|
603
|
+
const s = q.createElementNS(M, "g");
|
|
600
604
|
return [
|
|
601
605
|
{
|
|
602
606
|
name: "line",
|
|
@@ -611,15 +615,15 @@ const _t = function(e) {
|
|
|
611
615
|
d: n
|
|
612
616
|
}
|
|
613
617
|
].forEach((l, r) => {
|
|
614
|
-
const c = l.d, a =
|
|
618
|
+
const c = l.d, a = q.createElementNS(M, "path"), h = {
|
|
615
619
|
d: c,
|
|
616
620
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
617
621
|
fill: "none",
|
|
618
622
|
"stroke-linecap": o?.strokeLinecap || "cap",
|
|
619
623
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
620
624
|
};
|
|
621
|
-
o?.opacity !== void 0 && (
|
|
622
|
-
const u =
|
|
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");
|
|
623
627
|
k(u, {
|
|
624
628
|
d: c,
|
|
625
629
|
stroke: "transparent",
|
|
@@ -627,14 +631,14 @@ const _t = function(e) {
|
|
|
627
631
|
"stroke-width": "15"
|
|
628
632
|
}), s.appendChild(u), s.appendChild(a), s[l.name] = a;
|
|
629
633
|
}), s;
|
|
630
|
-
},
|
|
634
|
+
}, Qe = function(e, t, n) {
|
|
631
635
|
if (!t) return;
|
|
632
636
|
const o = n.label, s = t.cloneNode(!0);
|
|
633
637
|
e.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
|
|
634
638
|
left:${t.style.left};
|
|
635
639
|
top:${t.style.top};
|
|
636
640
|
max-width: 200px;
|
|
637
|
-
`,
|
|
641
|
+
`, Je(s), e.scrollIntoView(s), s.addEventListener("keydown", (i) => {
|
|
638
642
|
i.stopPropagation();
|
|
639
643
|
const l = i.key;
|
|
640
644
|
if (l === "Enter" || l === "Tab") {
|
|
@@ -644,7 +648,7 @@ const _t = function(e) {
|
|
|
644
648
|
}), s.addEventListener("blur", () => {
|
|
645
649
|
if (!s) return;
|
|
646
650
|
const i = s.textContent?.trim() || "";
|
|
647
|
-
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", {
|
|
648
652
|
name: "finishEditSummary",
|
|
649
653
|
obj: n
|
|
650
654
|
}) : e.bus.fire("operation", {
|
|
@@ -652,32 +656,32 @@ const _t = function(e) {
|
|
|
652
656
|
obj: n
|
|
653
657
|
}));
|
|
654
658
|
});
|
|
655
|
-
},
|
|
659
|
+
}, At = function(e) {
|
|
656
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");
|
|
657
661
|
this.lines.innerHTML = "";
|
|
658
662
|
for (let r = 0; r < l.length; r++) {
|
|
659
|
-
const c = l[r], a = c.querySelector("me-tpc"), { offsetLeft:
|
|
660
|
-
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)
|
|
661
665
|
continue;
|
|
662
|
-
const
|
|
663
|
-
|
|
666
|
+
const y = U("subLines"), w = c.lastChild;
|
|
667
|
+
w.tagName === "svg" && w.remove(), c.appendChild(y), et(this, y, f, c, m, !0);
|
|
664
668
|
}
|
|
665
669
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
666
|
-
},
|
|
670
|
+
}, et = function(e, t, n, o, s, i) {
|
|
667
671
|
const l = o.firstChild, r = o.children[1].children;
|
|
668
672
|
if (r.length === 0) return;
|
|
669
|
-
const c = l.offsetTop, a = l.offsetLeft,
|
|
673
|
+
const c = l.offsetTop, a = l.offsetLeft, h = l.offsetWidth, u = l.offsetHeight;
|
|
670
674
|
for (let g = 0; g < r.length; g++) {
|
|
671
|
-
const
|
|
672
|
-
t.appendChild(
|
|
673
|
-
const
|
|
674
|
-
if (
|
|
675
|
-
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;
|
|
676
680
|
} else
|
|
677
681
|
continue;
|
|
678
|
-
|
|
682
|
+
et(e, t, w, v, s);
|
|
679
683
|
}
|
|
680
|
-
},
|
|
684
|
+
}, Oe = {
|
|
681
685
|
addChild: "插入子节点",
|
|
682
686
|
addParent: "插入父节点",
|
|
683
687
|
addSibling: "插入同级节点",
|
|
@@ -690,9 +694,9 @@ const _t = function(e) {
|
|
|
690
694
|
linkBidirectional: "双向连接",
|
|
691
695
|
clickTips: "请点击目标节点",
|
|
692
696
|
summary: "摘要"
|
|
693
|
-
},
|
|
694
|
-
cn:
|
|
695
|
-
zh_CN:
|
|
697
|
+
}, je = {
|
|
698
|
+
cn: Oe,
|
|
699
|
+
zh_CN: Oe,
|
|
696
700
|
zh_TW: {
|
|
697
701
|
addChild: "插入子節點",
|
|
698
702
|
addParent: "插入父節點",
|
|
@@ -820,98 +824,98 @@ const _t = function(e) {
|
|
|
820
824
|
summary: "요약"
|
|
821
825
|
}
|
|
822
826
|
};
|
|
823
|
-
function
|
|
827
|
+
function Mt(e, t) {
|
|
824
828
|
t = t === !0 ? {
|
|
825
829
|
focus: !0,
|
|
826
830
|
link: !0
|
|
827
831
|
} : t;
|
|
828
|
-
const n = (
|
|
829
|
-
const
|
|
830
|
-
return
|
|
831
|
-
}, 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) => {
|
|
832
836
|
const N = document.createElement("li");
|
|
833
|
-
return N.id =
|
|
834
|
-
}, s =
|
|
835
|
-
if (
|
|
836
|
-
for (let
|
|
837
|
-
const
|
|
838
|
-
|
|
839
|
-
|
|
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);
|
|
840
844
|
};
|
|
841
845
|
}
|
|
842
|
-
const
|
|
843
|
-
|
|
844
|
-
let
|
|
845
|
-
const
|
|
846
|
-
const
|
|
847
|
-
if (
|
|
848
|
-
|
|
849
|
-
const C =
|
|
850
|
-
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");
|
|
851
855
|
}
|
|
852
856
|
};
|
|
853
|
-
e.bus.addListener("showContextMenu",
|
|
854
|
-
|
|
857
|
+
e.bus.addListener("showContextMenu", S), y.onclick = (x) => {
|
|
858
|
+
x.target === y && (y.hidden = !0);
|
|
855
859
|
}, l.onclick = () => {
|
|
856
|
-
e.addChild(),
|
|
860
|
+
e.addChild(), y.hidden = !0;
|
|
857
861
|
}, r.onclick = () => {
|
|
858
|
-
e.insertParent(),
|
|
862
|
+
e.insertParent(), y.hidden = !0;
|
|
859
863
|
}, c.onclick = () => {
|
|
860
|
-
|
|
864
|
+
w || (e.insertSibling("after"), y.hidden = !0);
|
|
861
865
|
}, a.onclick = () => {
|
|
862
|
-
|
|
863
|
-
},
|
|
864
|
-
|
|
866
|
+
w || (e.removeNodes(e.currentNodes || []), y.hidden = !0);
|
|
867
|
+
}, h.onclick = () => {
|
|
868
|
+
w || (e.focusNode(e.currentNode), y.hidden = !0);
|
|
865
869
|
}, u.onclick = () => {
|
|
866
|
-
e.cancelFocus(),
|
|
870
|
+
e.cancelFocus(), y.hidden = !0;
|
|
867
871
|
}, g.onclick = () => {
|
|
868
|
-
|
|
869
|
-
},
|
|
870
|
-
|
|
872
|
+
w || (e.moveUpNode(), y.hidden = !0);
|
|
873
|
+
}, v.onclick = () => {
|
|
874
|
+
w || (e.moveDownNode(), y.hidden = !0);
|
|
871
875
|
};
|
|
872
|
-
const
|
|
873
|
-
|
|
874
|
-
const
|
|
876
|
+
const E = (x) => {
|
|
877
|
+
y.hidden = !0;
|
|
878
|
+
const b = e.currentNode, C = n(i.clickTips);
|
|
875
879
|
e.container.appendChild(C), e.map.addEventListener(
|
|
876
880
|
"click",
|
|
877
881
|
(N) => {
|
|
878
882
|
N.preventDefault(), C.remove();
|
|
879
883
|
const L = N.target;
|
|
880
|
-
(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);
|
|
881
885
|
},
|
|
882
886
|
{
|
|
883
887
|
once: !0
|
|
884
888
|
}
|
|
885
889
|
);
|
|
886
890
|
};
|
|
887
|
-
return m.onclick = () =>
|
|
888
|
-
|
|
891
|
+
return m.onclick = () => E(), p.onclick = () => E({ bidirectional: !0 }), d.onclick = () => {
|
|
892
|
+
y.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
|
|
889
893
|
}, () => {
|
|
890
|
-
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;
|
|
891
895
|
};
|
|
892
896
|
}
|
|
893
|
-
const
|
|
897
|
+
const me = document, Dt = function(e, t) {
|
|
894
898
|
if (!t)
|
|
895
|
-
return
|
|
899
|
+
return ye(e), e;
|
|
896
900
|
let n = e.querySelector(".insert-preview");
|
|
897
901
|
const o = `insert-preview ${t} show`;
|
|
898
|
-
return n || (n =
|
|
899
|
-
},
|
|
902
|
+
return n || (n = me.createElement("div"), e.appendChild(n)), n.className = o, e;
|
|
903
|
+
}, ye = function(e) {
|
|
900
904
|
if (!e) return;
|
|
901
905
|
const t = e.querySelectorAll(".insert-preview");
|
|
902
906
|
for (const n of t || [])
|
|
903
907
|
n.remove();
|
|
904
|
-
},
|
|
908
|
+
}, He = function(e, t) {
|
|
905
909
|
for (const n of t) {
|
|
906
910
|
const o = n.parentElement.parentElement.contains(e);
|
|
907
911
|
if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent)) return !1;
|
|
908
912
|
}
|
|
909
913
|
return !0;
|
|
910
|
-
},
|
|
914
|
+
}, Pt = function(e) {
|
|
911
915
|
const t = document.createElement("div");
|
|
912
916
|
return t.className = "mind-elixir-ghost", e.container.appendChild(t), t;
|
|
913
917
|
};
|
|
914
|
-
class
|
|
918
|
+
class $t {
|
|
915
919
|
mind;
|
|
916
920
|
isMoving = !1;
|
|
917
921
|
interval = null;
|
|
@@ -928,61 +932,61 @@ class Pt {
|
|
|
928
932
|
this.isMoving = !1, clearInterval(this.interval);
|
|
929
933
|
}
|
|
930
934
|
}
|
|
931
|
-
function
|
|
935
|
+
function Ot(e) {
|
|
932
936
|
let t = null, n = null;
|
|
933
|
-
const o =
|
|
937
|
+
const o = Pt(e), s = new $t(e), i = (a) => {
|
|
934
938
|
if (e.spacePressed) {
|
|
935
939
|
a.preventDefault();
|
|
936
940
|
return;
|
|
937
941
|
}
|
|
938
942
|
e.selection.cancel();
|
|
939
|
-
const
|
|
940
|
-
if (
|
|
943
|
+
const h = a.target;
|
|
944
|
+
if (h?.tagName !== "ME-TPC") {
|
|
941
945
|
a.preventDefault();
|
|
942
946
|
return;
|
|
943
947
|
}
|
|
944
948
|
let u = e.currentNodes;
|
|
945
|
-
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;
|
|
946
950
|
for (const g of u)
|
|
947
951
|
g.parentElement.parentElement.style.opacity = "0.5";
|
|
948
952
|
a.dataTransfer.setDragImage(o, 0, 0), a.dataTransfer.dropEffect = "move", e.dragMoveHelper.clear();
|
|
949
953
|
}, l = (a) => {
|
|
950
|
-
const { dragged:
|
|
951
|
-
if (!
|
|
954
|
+
const { dragged: h } = e;
|
|
955
|
+
if (!h) return;
|
|
952
956
|
s.stop();
|
|
953
|
-
for (const g of
|
|
957
|
+
for (const g of h)
|
|
954
958
|
g.parentElement.parentElement.style.opacity = "1";
|
|
955
959
|
const u = a.target;
|
|
956
|
-
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 = "");
|
|
957
961
|
}, r = (a) => {
|
|
958
962
|
a.preventDefault();
|
|
959
|
-
const
|
|
963
|
+
const h = 12 * e.scaleVal, { dragged: u } = e;
|
|
960
964
|
if (!u) return;
|
|
961
965
|
const g = e.container.getBoundingClientRect();
|
|
962
|
-
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(),
|
|
963
|
-
const
|
|
964
|
-
if (
|
|
965
|
-
n =
|
|
966
|
-
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;
|
|
967
971
|
a.clientY > p + m.height ? t = "after" : t = "in";
|
|
968
972
|
} else {
|
|
969
|
-
const m =
|
|
970
|
-
if (
|
|
973
|
+
const m = me.elementFromPoint(a.clientX, a.clientY + h), p = m.getBoundingClientRect();
|
|
974
|
+
if (He(m, u)) {
|
|
971
975
|
n = m;
|
|
972
976
|
const d = p.y;
|
|
973
977
|
a.clientY < d ? t = "before" : t = "in";
|
|
974
978
|
} else
|
|
975
979
|
t = n = null;
|
|
976
980
|
}
|
|
977
|
-
n &&
|
|
981
|
+
n && Dt(n, t);
|
|
978
982
|
};
|
|
979
|
-
return
|
|
983
|
+
return Ce([
|
|
980
984
|
{ dom: e.map, evt: "dragstart", func: i },
|
|
981
985
|
{ dom: e.map, evt: "dragend", func: l },
|
|
982
986
|
{ dom: e.map, evt: "dragover", func: r }
|
|
983
987
|
]);
|
|
984
988
|
}
|
|
985
|
-
const
|
|
989
|
+
const jt = function(e) {
|
|
986
990
|
return ["createSummary", "removeSummary", "finishEditSummary"].includes(e.name) ? {
|
|
987
991
|
type: "summary",
|
|
988
992
|
value: e.obj.id
|
|
@@ -997,7 +1001,7 @@ const Ot = function(e) {
|
|
|
997
1001
|
value: [e.obj.id]
|
|
998
1002
|
};
|
|
999
1003
|
};
|
|
1000
|
-
function
|
|
1004
|
+
function Ht(e) {
|
|
1001
1005
|
let t = [], n = -1, o = e.getData(), s = [];
|
|
1002
1006
|
e.undo = function() {
|
|
1003
1007
|
if (n > -1) {
|
|
@@ -1024,14 +1028,14 @@ function jt(e) {
|
|
|
1024
1028
|
const i = function(c) {
|
|
1025
1029
|
if (c.name === "beginEdit") return;
|
|
1026
1030
|
t = t.slice(0, n + 1);
|
|
1027
|
-
const a = e.getData(),
|
|
1031
|
+
const a = e.getData(), h = {
|
|
1028
1032
|
prev: o,
|
|
1029
1033
|
operation: c.name,
|
|
1030
1034
|
currentSelected: s.map((u) => u.id),
|
|
1031
|
-
currentTarget:
|
|
1035
|
+
currentTarget: jt(c),
|
|
1032
1036
|
next: a
|
|
1033
1037
|
};
|
|
1034
|
-
t.push(
|
|
1038
|
+
t.push(h), o = a, n = t.length - 1;
|
|
1035
1039
|
}, l = function(c) {
|
|
1036
1040
|
(c.metaKey || c.ctrlKey) && (c.shiftKey && c.key === "Z" || c.key === "y") ? e.redo() : (c.metaKey || c.ctrlKey) && c.key === "z" && e.undo();
|
|
1037
1041
|
}, r = function() {
|
|
@@ -1041,19 +1045,19 @@ function jt(e) {
|
|
|
1041
1045
|
e.bus.removeListener("operation", i), e.bus.removeListener("selectNodes", r), e.container.removeEventListener("keydown", l);
|
|
1042
1046
|
};
|
|
1043
1047
|
}
|
|
1044
|
-
const
|
|
1045
|
-
side:
|
|
1046
|
-
left:
|
|
1047
|
-
right:
|
|
1048
|
-
full:
|
|
1049
|
-
living:
|
|
1050
|
-
zoomin:
|
|
1051
|
-
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
|
|
1052
1056
|
}, F = (e, t) => {
|
|
1053
1057
|
const n = document.createElement("span");
|
|
1054
|
-
return n.id = e, n.innerHTML =
|
|
1058
|
+
return n.id = e, n.innerHTML = Yt[t], n;
|
|
1055
1059
|
};
|
|
1056
|
-
function
|
|
1060
|
+
function zt(e) {
|
|
1057
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");
|
|
1058
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 = () => {
|
|
1059
1063
|
document.fullscreenElement === e.el ? document.exitFullscreen() : e.el.requestFullscreen();
|
|
@@ -1075,10 +1079,10 @@ function qt(e) {
|
|
|
1075
1079
|
e.initSide();
|
|
1076
1080
|
}, t;
|
|
1077
1081
|
}
|
|
1078
|
-
function
|
|
1079
|
-
e.container.append(
|
|
1082
|
+
function Vt(e) {
|
|
1083
|
+
e.container.append(zt(e)), e.container.append(qt(e));
|
|
1080
1084
|
}
|
|
1081
|
-
class
|
|
1085
|
+
class Xt {
|
|
1082
1086
|
_listeners = /* @__PURE__ */ new Map();
|
|
1083
1087
|
addEventListener(t, n) {
|
|
1084
1088
|
const o = this._listeners.get(t) ?? /* @__PURE__ */ new Set();
|
|
@@ -1101,15 +1105,15 @@ class Vt {
|
|
|
1101
1105
|
off = this.removeEventListener;
|
|
1102
1106
|
emit = this.dispatchEvent;
|
|
1103
1107
|
}
|
|
1104
|
-
const
|
|
1108
|
+
const Be = (e, t = "px") => typeof e == "number" ? e + t : e, H = ({ style: e }, t, n) => {
|
|
1105
1109
|
if (typeof t == "object")
|
|
1106
1110
|
for (const [o, s] of Object.entries(t))
|
|
1107
|
-
s !== void 0 && (e[o] =
|
|
1108
|
-
else n !== void 0 && (e[t] =
|
|
1109
|
-
},
|
|
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) => {
|
|
1110
1114
|
const s = { x: e, y: t, width: n, height: o, top: t, left: e, right: e + n, bottom: t + o };
|
|
1111
1115
|
return { ...s, toJSON: () => JSON.stringify(s) };
|
|
1112
|
-
},
|
|
1116
|
+
}, Ut = (e) => {
|
|
1113
1117
|
let t, n = -1, o = !1;
|
|
1114
1118
|
return {
|
|
1115
1119
|
next: (...s) => {
|
|
@@ -1121,7 +1125,7 @@ const He = (e, t = "px") => typeof e == "number" ? e + t : e, H = ({ style: e },
|
|
|
1121
1125
|
cancelAnimationFrame(n), o = !1;
|
|
1122
1126
|
}
|
|
1123
1127
|
};
|
|
1124
|
-
},
|
|
1128
|
+
}, Ie = (e, t, n = "touch") => {
|
|
1125
1129
|
switch (n) {
|
|
1126
1130
|
case "center": {
|
|
1127
1131
|
const o = t.left + t.width / 2, s = t.top + t.height / 2;
|
|
@@ -1132,16 +1136,16 @@ const He = (e, t = "px") => typeof e == "number" ? e + t : e, H = ({ style: e },
|
|
|
1132
1136
|
case "touch":
|
|
1133
1137
|
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
|
|
1134
1138
|
}
|
|
1135
|
-
},
|
|
1136
|
-
(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);
|
|
1137
1141
|
for (const i of t)
|
|
1138
1142
|
if (i)
|
|
1139
1143
|
for (const l of n)
|
|
1140
1144
|
i[e](l, o, { capture: !1, ...s });
|
|
1141
|
-
}, B =
|
|
1145
|
+
}, B = tt("addEventListener"), A = tt("removeEventListener"), ee = (e) => {
|
|
1142
1146
|
const { clientX: t, clientY: n, target: o } = e.touches?.[0] ?? e;
|
|
1143
1147
|
return { x: t, y: n, target: o };
|
|
1144
|
-
}, 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) => {
|
|
1145
1149
|
switch (o) {
|
|
1146
1150
|
case "alt":
|
|
1147
1151
|
return e.altKey;
|
|
@@ -1150,18 +1154,18 @@ const He = (e, t = "px") => typeof e == "number" ? e + t : e, H = ({ style: e },
|
|
|
1150
1154
|
case "shift":
|
|
1151
1155
|
return e.shiftKey;
|
|
1152
1156
|
}
|
|
1153
|
-
}) : !1), { abs: I, max:
|
|
1157
|
+
}) : !1), { abs: I, max: Fe, min: We, ceil: Ke } = Math, Ge = (e = []) => ({
|
|
1154
1158
|
stored: e,
|
|
1155
1159
|
selected: [],
|
|
1156
1160
|
touched: [],
|
|
1157
1161
|
changed: { added: [], removed: [] }
|
|
1158
1162
|
});
|
|
1159
|
-
class
|
|
1163
|
+
class en extends Xt {
|
|
1160
1164
|
static version = "mind-elixir-fork";
|
|
1161
1165
|
// Options
|
|
1162
1166
|
_options;
|
|
1163
1167
|
// Selection store
|
|
1164
|
-
_selection =
|
|
1168
|
+
_selection = Ge();
|
|
1165
1169
|
// Area element and clipping element
|
|
1166
1170
|
_area;
|
|
1167
1171
|
_clippingElement;
|
|
@@ -1174,7 +1178,7 @@ class Qt extends Vt {
|
|
|
1174
1178
|
_latestElement;
|
|
1175
1179
|
// Dynamically constructed area rect
|
|
1176
1180
|
_areaLocation = { y1: 0, x2: 0, y2: 0, x1: 0 };
|
|
1177
|
-
_areaRect =
|
|
1181
|
+
_areaRect = Re();
|
|
1178
1182
|
// If a single click is being performed, it's a single-click until the user dragged the mouse
|
|
1179
1183
|
_singleClick = !0;
|
|
1180
1184
|
_frame;
|
|
@@ -1241,22 +1245,22 @@ class Qt extends Vt {
|
|
|
1241
1245
|
// https://stackoverflow.com/a/38268846
|
|
1242
1246
|
pointerEvents: "none",
|
|
1243
1247
|
zIndex: "1"
|
|
1244
|
-
}), this._frame =
|
|
1248
|
+
}), this._frame = Ut((i) => {
|
|
1245
1249
|
this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", i), this._redrawSelectionArea();
|
|
1246
1250
|
}), this.enable();
|
|
1247
1251
|
}
|
|
1248
1252
|
_toggleStartEvents(t = !0) {
|
|
1249
|
-
const { document: n, features: o } = this._options, s = t ? B :
|
|
1253
|
+
const { document: n, features: o } = this._options, s = t ? B : A;
|
|
1250
1254
|
s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, { passive: !1 });
|
|
1251
1255
|
}
|
|
1252
1256
|
_onTapStart(t, n = !1) {
|
|
1253
|
-
const { x: o, y: s, target: i } =
|
|
1254
|
-
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))
|
|
1255
1259
|
return;
|
|
1256
|
-
const g = K(r, l),
|
|
1257
|
-
this._targetElement =
|
|
1258
|
-
const m = t.composedPath(), p = g.find((
|
|
1259
|
-
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)
|
|
1260
1264
|
return;
|
|
1261
1265
|
this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
|
|
1262
1266
|
const d = l.scrollingElement ?? l.body;
|
|
@@ -1266,7 +1270,7 @@ class Qt extends Vt {
|
|
|
1266
1270
|
const {
|
|
1267
1271
|
singleTap: { intersect: n },
|
|
1268
1272
|
range: o
|
|
1269
|
-
} = this._options.features, s =
|
|
1273
|
+
} = this._options.features, s = ee(t);
|
|
1270
1274
|
let i;
|
|
1271
1275
|
if (n === "native")
|
|
1272
1276
|
i = s.target;
|
|
@@ -1274,8 +1278,8 @@ class Qt extends Vt {
|
|
|
1274
1278
|
this.resolveSelectables();
|
|
1275
1279
|
const { x: r, y: c } = s;
|
|
1276
1280
|
i = this._selectables.find((a) => {
|
|
1277
|
-
const { right:
|
|
1278
|
-
return r <
|
|
1281
|
+
const { right: h, left: u, top: g, bottom: v } = a.getBoundingClientRect();
|
|
1282
|
+
return r < h && r > u && c < v && c > g;
|
|
1279
1283
|
});
|
|
1280
1284
|
}
|
|
1281
1285
|
if (!i)
|
|
@@ -1289,12 +1293,12 @@ class Qt extends Vt {
|
|
|
1289
1293
|
}
|
|
1290
1294
|
const { stored: l } = this._selection;
|
|
1291
1295
|
if (this._emitEvent("start", t), t.shiftKey && o && this._latestElement) {
|
|
1292
|
-
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 = [
|
|
1293
1297
|
...this._selectables.filter((u) => u.compareDocumentPosition(c) & 4 && u.compareDocumentPosition(a) & 2),
|
|
1294
1298
|
c,
|
|
1295
1299
|
a
|
|
1296
1300
|
];
|
|
1297
|
-
this.select(
|
|
1301
|
+
this.select(h), this._latestElement = r;
|
|
1298
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);
|
|
1299
1303
|
}
|
|
1300
1304
|
_delayedTapMove(t) {
|
|
@@ -1302,14 +1306,14 @@ class Qt extends Vt {
|
|
|
1302
1306
|
container: n,
|
|
1303
1307
|
document: o,
|
|
1304
1308
|
behaviour: { startThreshold: s }
|
|
1305
|
-
} = 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);
|
|
1306
1310
|
if (
|
|
1307
1311
|
// Single number for both coordinates
|
|
1308
1312
|
typeof s == "number" && I(r + c - (i + l)) >= s || // Different x and y threshold
|
|
1309
1313
|
typeof s == "object" && I(r - i) >= s.x || I(c - l) >= s.y
|
|
1310
1314
|
) {
|
|
1311
|
-
if (
|
|
1312
|
-
|
|
1315
|
+
if (A(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1316
|
+
A(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
|
|
1313
1317
|
return;
|
|
1314
1318
|
}
|
|
1315
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);
|
|
@@ -1339,7 +1343,7 @@ class Qt extends Vt {
|
|
|
1339
1343
|
_onTapMove(t) {
|
|
1340
1344
|
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: l } = s.behaviour.scrolling;
|
|
1341
1345
|
this._targetElement;
|
|
1342
|
-
const { x: r, y: c } =
|
|
1346
|
+
const { x: r, y: c } = ee(t);
|
|
1343
1347
|
if (o.x2 = r, o.y2 = c, this._lastMousePosition.x = r, this._lastMousePosition.y = c, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
|
|
1344
1348
|
this._scrollingActive = !0;
|
|
1345
1349
|
const a = () => {
|
|
@@ -1347,10 +1351,10 @@ class Qt extends Vt {
|
|
|
1347
1351
|
this._scrollingActive = !1;
|
|
1348
1352
|
return;
|
|
1349
1353
|
}
|
|
1350
|
-
const
|
|
1351
|
-
if (
|
|
1352
|
-
const u = n.x ?
|
|
1353
|
-
(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);
|
|
1354
1358
|
}
|
|
1355
1359
|
i.next(t), requestAnimationFrame(a);
|
|
1356
1360
|
};
|
|
@@ -1361,7 +1365,7 @@ class Qt extends Vt {
|
|
|
1361
1365
|
}
|
|
1362
1366
|
_handleMoveEvent(t) {
|
|
1363
1367
|
const { features: n } = this._options;
|
|
1364
|
-
(n.touch &&
|
|
1368
|
+
(n.touch && Jt() || this._scrollAvailable && Zt()) && t.preventDefault();
|
|
1365
1369
|
}
|
|
1366
1370
|
_onScroll() {
|
|
1367
1371
|
const {
|
|
@@ -1371,7 +1375,7 @@ class Qt extends Vt {
|
|
|
1371
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);
|
|
1372
1376
|
}
|
|
1373
1377
|
_onStartAreaScroll() {
|
|
1374
|
-
this._targetBoundaryScrolled = !0,
|
|
1378
|
+
this._targetBoundaryScrolled = !0, A(this._targetElement, "scroll", this._onStartAreaScroll);
|
|
1375
1379
|
}
|
|
1376
1380
|
_wheelScroll(t) {
|
|
1377
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;
|
|
@@ -1391,12 +1395,12 @@ class Qt extends Vt {
|
|
|
1391
1395
|
let { x2: c, y2: a } = n;
|
|
1392
1396
|
const {
|
|
1393
1397
|
behaviour: {
|
|
1394
|
-
scrolling: { startScrollMargins:
|
|
1398
|
+
scrolling: { startScrollMargins: h }
|
|
1395
1399
|
}
|
|
1396
1400
|
} = s;
|
|
1397
|
-
c < i.left +
|
|
1398
|
-
const u =
|
|
1399
|
-
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);
|
|
1400
1404
|
}
|
|
1401
1405
|
_redrawSelectionArea() {
|
|
1402
1406
|
const { x: t, y: n, width: o, height: s } = this._areaRect, { style: i } = this._area;
|
|
@@ -1404,32 +1408,32 @@ class Qt extends Vt {
|
|
|
1404
1408
|
}
|
|
1405
1409
|
_onTapStop(t, n) {
|
|
1406
1410
|
const { document: o, features: s } = this._options, { _singleClick: i } = this;
|
|
1407
|
-
|
|
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");
|
|
1408
1412
|
}
|
|
1409
1413
|
_updateElementSelection() {
|
|
1410
|
-
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 = [];
|
|
1411
1415
|
for (let p = 0; p < t.length; p++) {
|
|
1412
1416
|
const d = t[p];
|
|
1413
|
-
if (
|
|
1417
|
+
if (Ie(s, d.getBoundingClientRect(), c)) {
|
|
1414
1418
|
if (l.includes(d))
|
|
1415
1419
|
i.includes(d) && !r.includes(d) && r.push(d);
|
|
1416
|
-
else if (
|
|
1417
|
-
|
|
1420
|
+
else if (h && i.includes(d)) {
|
|
1421
|
+
v.push(d);
|
|
1418
1422
|
continue;
|
|
1419
1423
|
} else
|
|
1420
1424
|
g.push(d);
|
|
1421
1425
|
u.push(d);
|
|
1422
1426
|
}
|
|
1423
1427
|
}
|
|
1424
|
-
|
|
1428
|
+
h && g.push(...i.filter((p) => !l.includes(p)));
|
|
1425
1429
|
const m = a === "keep";
|
|
1426
1430
|
for (let p = 0; p < l.length; p++) {
|
|
1427
1431
|
const d = l[p];
|
|
1428
1432
|
!u.includes(d) && !// Check if the user wants to keep previously selected elements, e.g.,
|
|
1429
1433
|
// not make them part of the current selection as soon as they're touched.
|
|
1430
|
-
(m && i.includes(d)) &&
|
|
1434
|
+
(m && i.includes(d)) && v.push(d);
|
|
1431
1435
|
}
|
|
1432
|
-
o.selected = u, o.changed = { added: g, removed:
|
|
1436
|
+
o.selected = u, o.changed = { added: g, removed: v }, this._latestElement = void 0;
|
|
1433
1437
|
}
|
|
1434
1438
|
_emitEvent(t, n) {
|
|
1435
1439
|
return this.emit(t, {
|
|
@@ -1489,7 +1493,7 @@ class Qt extends Vt {
|
|
|
1489
1493
|
*/
|
|
1490
1494
|
clearSelection(t = !0, n = !1) {
|
|
1491
1495
|
const { selected: o, stored: s, changed: i } = this._selection;
|
|
1492
|
-
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);
|
|
1493
1497
|
}
|
|
1494
1498
|
/**
|
|
1495
1499
|
* @returns {Array} Selected elements
|
|
@@ -1562,8 +1566,8 @@ class Qt extends Vt {
|
|
|
1562
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));
|
|
1563
1567
|
}
|
|
1564
1568
|
}
|
|
1565
|
-
function
|
|
1566
|
-
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new
|
|
1569
|
+
function tn(e) {
|
|
1570
|
+
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new en({
|
|
1567
1571
|
selectables: [".map-container me-tpc"],
|
|
1568
1572
|
boundaries: [e.container],
|
|
1569
1573
|
container: e.selectionContainer,
|
|
@@ -1622,10 +1626,10 @@ function en(e) {
|
|
|
1622
1626
|
);
|
|
1623
1627
|
e.selection = n;
|
|
1624
1628
|
}
|
|
1625
|
-
const
|
|
1629
|
+
const nn = function(e, t = !0) {
|
|
1626
1630
|
this.theme = e;
|
|
1627
1631
|
const o = {
|
|
1628
|
-
...(e.type === "dark" ?
|
|
1632
|
+
...(e.type === "dark" ? we : be).cssVar,
|
|
1629
1633
|
...e.cssVar
|
|
1630
1634
|
}, s = Object.keys(o);
|
|
1631
1635
|
for (let i = 0; i < s.length; i++) {
|
|
@@ -1637,32 +1641,32 @@ const tn = function(e, t = !0) {
|
|
|
1637
1641
|
const t = e.parent?.children, n = t?.indexOf(e) ?? 0;
|
|
1638
1642
|
return { siblings: t, index: n };
|
|
1639
1643
|
};
|
|
1640
|
-
function
|
|
1644
|
+
function on(e) {
|
|
1641
1645
|
const { siblings: t, index: n } = V(e);
|
|
1642
1646
|
if (t === void 0) return;
|
|
1643
1647
|
const o = t[n];
|
|
1644
1648
|
n === 0 ? (t[n] = t[t.length - 1], t[t.length - 1] = o) : (t[n] = t[n - 1], t[n - 1] = o);
|
|
1645
1649
|
}
|
|
1646
|
-
function
|
|
1650
|
+
function sn(e) {
|
|
1647
1651
|
const { siblings: t, index: n } = V(e);
|
|
1648
1652
|
if (t === void 0) return;
|
|
1649
1653
|
const o = t[n];
|
|
1650
1654
|
n === t.length - 1 ? (t[n] = t[0], t[0] = o) : (t[n] = t[n + 1], t[n + 1] = o);
|
|
1651
1655
|
}
|
|
1652
|
-
function
|
|
1656
|
+
function nt(e) {
|
|
1653
1657
|
const { siblings: t, index: n } = V(e);
|
|
1654
1658
|
return t === void 0 ? 0 : (t.splice(n, 1), t.length);
|
|
1655
1659
|
}
|
|
1656
|
-
function
|
|
1660
|
+
function rn(e, t, n) {
|
|
1657
1661
|
const { siblings: o, index: s } = V(n);
|
|
1658
1662
|
o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
|
|
1659
1663
|
}
|
|
1660
|
-
function
|
|
1664
|
+
function ln(e, t) {
|
|
1661
1665
|
const { siblings: n, index: o } = V(e);
|
|
1662
1666
|
n !== void 0 && (n[o] = t, t.children = [e]);
|
|
1663
1667
|
}
|
|
1664
|
-
function
|
|
1665
|
-
if (
|
|
1668
|
+
function ot(e, t, n) {
|
|
1669
|
+
if (nt(t), n.parent?.parent || (t.direction = n.direction), e === "in")
|
|
1666
1670
|
n.children ? n.children.push(t) : n.children = [t];
|
|
1667
1671
|
else {
|
|
1668
1672
|
t.direction !== void 0 && (t.direction = n.direction);
|
|
@@ -1671,7 +1675,7 @@ function nt(e, t, n) {
|
|
|
1671
1675
|
e === "before" ? o.splice(s, 0, t) : o.splice(s + 1, 0, t);
|
|
1672
1676
|
}
|
|
1673
1677
|
}
|
|
1674
|
-
const
|
|
1678
|
+
const cn = function({ map: e, direction: t }, n) {
|
|
1675
1679
|
if (t === 0)
|
|
1676
1680
|
return 0;
|
|
1677
1681
|
if (t === 1)
|
|
@@ -1680,55 +1684,55 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1680
1684
|
const o = e.querySelector(".lhs")?.childElementCount || 0, s = e.querySelector(".rhs")?.childElementCount || 0;
|
|
1681
1685
|
return o <= s ? (n.direction = 0, 0) : (n.direction = 1, 1);
|
|
1682
1686
|
}
|
|
1683
|
-
},
|
|
1687
|
+
}, st = function(e, t, n) {
|
|
1684
1688
|
const o = n.children[0].children[0], s = t.parentElement;
|
|
1685
1689
|
if (s.tagName === "ME-PARENT") {
|
|
1686
|
-
if (
|
|
1690
|
+
if (J(o), s.children[1])
|
|
1687
1691
|
s.nextSibling.appendChild(n);
|
|
1688
1692
|
else {
|
|
1689
1693
|
const i = e.createChildren([n]);
|
|
1690
|
-
s.appendChild(
|
|
1694
|
+
s.appendChild(Ne(!0)), s.insertAdjacentElement("afterend", i);
|
|
1691
1695
|
}
|
|
1692
1696
|
e.linkDiv(n.offsetParent);
|
|
1693
|
-
} else s.tagName === "ME-ROOT" && (
|
|
1694
|
-
},
|
|
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) {
|
|
1695
1699
|
const n = e.parentNode;
|
|
1696
1700
|
if (t === 0) {
|
|
1697
1701
|
const o = n.parentNode.parentNode;
|
|
1698
1702
|
o.tagName !== "ME-MAIN" && (o.previousSibling.children[1].remove(), o.remove());
|
|
1699
1703
|
}
|
|
1700
1704
|
n.parentNode.remove();
|
|
1701
|
-
},
|
|
1705
|
+
}, it = {
|
|
1702
1706
|
before: "beforebegin",
|
|
1703
1707
|
after: "afterend"
|
|
1704
|
-
},
|
|
1708
|
+
}, J = function(e) {
|
|
1705
1709
|
const n = e.parentElement.parentElement.lastElementChild;
|
|
1706
1710
|
n?.tagName === "svg" && n?.remove();
|
|
1707
|
-
},
|
|
1708
|
-
const n = e.nodeObj, o =
|
|
1711
|
+
}, dn = function(e, t) {
|
|
1712
|
+
const n = e.nodeObj, o = Ee(n);
|
|
1709
1713
|
o.style && t.style && (t.style = Object.assign(o.style, t.style));
|
|
1710
1714
|
const s = Object.assign(n, t);
|
|
1711
|
-
|
|
1715
|
+
Se.call(this, e, s), this.linkDiv(), this.bus.fire("operation", {
|
|
1712
1716
|
name: "reshapeNode",
|
|
1713
1717
|
obj: s,
|
|
1714
1718
|
origin: o
|
|
1715
1719
|
});
|
|
1716
|
-
},
|
|
1720
|
+
}, ke = function(e, t, n) {
|
|
1717
1721
|
if (!t) return null;
|
|
1718
1722
|
const o = t.nodeObj;
|
|
1719
1723
|
o.expanded === !1 && (e.expandNode(t, !0), t = e.findEle(o.id));
|
|
1720
1724
|
const s = n || e.generateNewObj();
|
|
1721
1725
|
o.children ? o.children.push(s) : o.children = [s], R(e.nodeData);
|
|
1722
1726
|
const { grp: i, top: l } = e.createWrapper(s);
|
|
1723
|
-
return
|
|
1724
|
-
},
|
|
1727
|
+
return st(e, t, i), { newTop: l, newNodeObj: s };
|
|
1728
|
+
}, hn = function(e, t, n) {
|
|
1725
1729
|
const o = t || this.currentNode;
|
|
1726
1730
|
if (!o) return;
|
|
1727
1731
|
const s = o.nodeObj;
|
|
1728
1732
|
if (s.parent) {
|
|
1729
1733
|
if (!s.parent?.parent && this.direction === 2) {
|
|
1730
|
-
const a = this.map.querySelector(".lhs")?.childElementCount || 0,
|
|
1731
|
-
if (!a || !
|
|
1734
|
+
const a = this.map.querySelector(".lhs")?.childElementCount || 0, h = this.map.querySelector(".rhs")?.childElementCount || 0;
|
|
1735
|
+
if (!a || !h) {
|
|
1732
1736
|
this.addChild(this.findEle(s.parent.id), n);
|
|
1733
1737
|
return;
|
|
1734
1738
|
}
|
|
@@ -1739,59 +1743,59 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1739
1743
|
}
|
|
1740
1744
|
const i = n || this.generateNewObj();
|
|
1741
1745
|
if (!s.parent?.parent) {
|
|
1742
|
-
const a = o.closest("me-main").className ===
|
|
1746
|
+
const a = o.closest("me-main").className === D.LHS ? 0 : 1;
|
|
1743
1747
|
i.direction = a;
|
|
1744
1748
|
}
|
|
1745
|
-
|
|
1749
|
+
rn(i, e, s), R(this.nodeData);
|
|
1746
1750
|
const l = o.parentElement, { grp: r, top: c } = this.createWrapper(i);
|
|
1747
|
-
l.parentElement.insertAdjacentElement(
|
|
1751
|
+
l.parentElement.insertAdjacentElement(it[e], r), this.linkDiv(r.offsetParent), n || this.editTopic(c.firstChild), this.bus.fire("operation", {
|
|
1748
1752
|
name: "insertSibling",
|
|
1749
1753
|
type: e,
|
|
1750
1754
|
obj: i
|
|
1751
1755
|
}), this.selectNode(c.firstChild, !0);
|
|
1752
|
-
},
|
|
1756
|
+
}, fn = function(e, t) {
|
|
1753
1757
|
const n = e || this.currentNode;
|
|
1754
1758
|
if (!n) return;
|
|
1755
|
-
|
|
1759
|
+
J(n);
|
|
1756
1760
|
const o = n.nodeObj;
|
|
1757
1761
|
if (!o.parent)
|
|
1758
1762
|
return;
|
|
1759
1763
|
const s = t || this.generateNewObj();
|
|
1760
|
-
|
|
1764
|
+
ln(o, s), R(this.nodeData);
|
|
1761
1765
|
const i = n.parentElement.parentElement, { grp: l, top: r } = this.createWrapper(s, !0);
|
|
1762
|
-
r.appendChild(
|
|
1766
|
+
r.appendChild(Ne(!0)), i.insertAdjacentElement("afterend", l);
|
|
1763
1767
|
const c = this.createChildren([i]);
|
|
1764
1768
|
r.insertAdjacentElement("afterend", c), this.linkDiv(), t || this.editTopic(r.firstChild), this.selectNode(r.firstChild, !0), this.bus.fire("operation", {
|
|
1765
1769
|
name: "insertParent",
|
|
1766
1770
|
obj: s
|
|
1767
1771
|
});
|
|
1768
|
-
},
|
|
1772
|
+
}, un = function(e, t) {
|
|
1769
1773
|
const n = e || this.currentNode;
|
|
1770
1774
|
if (!n) return;
|
|
1771
|
-
const o =
|
|
1775
|
+
const o = ke(this, n, t);
|
|
1772
1776
|
if (!o) return;
|
|
1773
1777
|
const { newTop: s, newNodeObj: i } = o;
|
|
1774
1778
|
this.bus.fire("operation", {
|
|
1775
1779
|
name: "addChild",
|
|
1776
1780
|
obj: i
|
|
1777
1781
|
}), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
|
|
1778
|
-
},
|
|
1779
|
-
const n =
|
|
1780
|
-
|
|
1781
|
-
const o =
|
|
1782
|
+
}, pn = function(e, t) {
|
|
1783
|
+
const n = Ee(e.nodeObj);
|
|
1784
|
+
xe(n);
|
|
1785
|
+
const o = ke(this, t, n);
|
|
1782
1786
|
if (!o) return;
|
|
1783
1787
|
const { newNodeObj: s } = o;
|
|
1784
1788
|
this.selectNode(this.findEle(s.id)), this.bus.fire("operation", {
|
|
1785
1789
|
name: "copyNode",
|
|
1786
1790
|
obj: s
|
|
1787
1791
|
});
|
|
1788
|
-
},
|
|
1789
|
-
e =
|
|
1792
|
+
}, gn = function(e, t) {
|
|
1793
|
+
e = ae(e);
|
|
1790
1794
|
const n = [];
|
|
1791
1795
|
for (let o = 0; o < e.length; o++) {
|
|
1792
|
-
const s = e[o], i =
|
|
1793
|
-
|
|
1794
|
-
const l =
|
|
1796
|
+
const s = e[o], i = Ee(s.nodeObj);
|
|
1797
|
+
xe(i);
|
|
1798
|
+
const l = ke(this, t, i);
|
|
1795
1799
|
if (!l) return;
|
|
1796
1800
|
const { newNodeObj: r } = l;
|
|
1797
1801
|
n.push(r);
|
|
@@ -1800,61 +1804,61 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1800
1804
|
name: "copyNodes",
|
|
1801
1805
|
objs: n
|
|
1802
1806
|
});
|
|
1803
|
-
},
|
|
1807
|
+
}, mn = function(e) {
|
|
1804
1808
|
const t = e || this.currentNode;
|
|
1805
1809
|
if (!t) return;
|
|
1806
1810
|
const n = t.nodeObj;
|
|
1807
|
-
|
|
1811
|
+
on(n);
|
|
1808
1812
|
const o = t.parentNode.parentNode;
|
|
1809
1813
|
o.parentNode.insertBefore(o, o.previousSibling), this.linkDiv(), this.bus.fire("operation", {
|
|
1810
1814
|
name: "moveUpNode",
|
|
1811
1815
|
obj: n
|
|
1812
1816
|
});
|
|
1813
|
-
},
|
|
1817
|
+
}, yn = function(e) {
|
|
1814
1818
|
const t = e || this.currentNode;
|
|
1815
1819
|
if (!t) return;
|
|
1816
1820
|
const n = t.nodeObj;
|
|
1817
|
-
|
|
1821
|
+
sn(n);
|
|
1818
1822
|
const o = t.parentNode.parentNode;
|
|
1819
1823
|
o.nextSibling ? o.nextSibling.insertAdjacentElement("afterend", o) : o.parentNode.prepend(o), this.linkDiv(), this.bus.fire("operation", {
|
|
1820
1824
|
name: "moveDownNode",
|
|
1821
1825
|
obj: n
|
|
1822
1826
|
});
|
|
1823
|
-
},
|
|
1827
|
+
}, vn = function(e) {
|
|
1824
1828
|
if (e.length === 0) return;
|
|
1825
|
-
e =
|
|
1829
|
+
e = ae(e);
|
|
1826
1830
|
for (const n of e) {
|
|
1827
|
-
const o = n.nodeObj, s =
|
|
1828
|
-
|
|
1831
|
+
const o = n.nodeObj, s = nt(o);
|
|
1832
|
+
an(n, s);
|
|
1829
1833
|
}
|
|
1830
1834
|
const t = e[e.length - 1];
|
|
1831
1835
|
this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
|
|
1832
1836
|
name: "removeNodes",
|
|
1833
1837
|
objs: e.map((n) => n.nodeObj)
|
|
1834
1838
|
});
|
|
1835
|
-
},
|
|
1836
|
-
e =
|
|
1839
|
+
}, bn = function(e, t) {
|
|
1840
|
+
e = ae(e);
|
|
1837
1841
|
const n = t.nodeObj;
|
|
1838
1842
|
n.expanded === !1 && (this.expandNode(t, !0), t = this.findEle(n.id));
|
|
1839
1843
|
for (const o of e) {
|
|
1840
1844
|
const s = o.nodeObj;
|
|
1841
|
-
|
|
1845
|
+
ot("in", s, n), R(this.nodeData);
|
|
1842
1846
|
const i = o.parentElement;
|
|
1843
|
-
|
|
1847
|
+
st(this, t, i.parentElement);
|
|
1844
1848
|
}
|
|
1845
1849
|
this.linkDiv(), this.bus.fire("operation", {
|
|
1846
1850
|
name: "moveNodeIn",
|
|
1847
1851
|
objs: e.map((o) => o.nodeObj),
|
|
1848
1852
|
toObj: n
|
|
1849
1853
|
});
|
|
1850
|
-
},
|
|
1851
|
-
e =
|
|
1854
|
+
}, rt = (e, t, n, o) => {
|
|
1855
|
+
e = ae(e), t === "after" && (e = e.reverse());
|
|
1852
1856
|
const s = n.nodeObj, i = [];
|
|
1853
1857
|
for (const l of e) {
|
|
1854
1858
|
const r = l.nodeObj;
|
|
1855
|
-
|
|
1859
|
+
ot(t, r, s), R(o.nodeData), J(l);
|
|
1856
1860
|
const c = l.parentElement.parentNode;
|
|
1857
|
-
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);
|
|
1858
1862
|
}
|
|
1859
1863
|
for (const l of i)
|
|
1860
1864
|
l.childElementCount === 0 && l.tagName !== "ME-MAIN" && (l.previousSibling.children[1].remove(), l.remove());
|
|
@@ -1863,34 +1867,34 @@ const ln = function({ map: e, direction: t }, n) {
|
|
|
1863
1867
|
objs: e.map((l) => l.nodeObj),
|
|
1864
1868
|
toObj: s
|
|
1865
1869
|
});
|
|
1866
|
-
}, bn = function(e, t) {
|
|
1867
|
-
it(e, "before", t, this);
|
|
1868
1870
|
}, wn = function(e, t) {
|
|
1869
|
-
|
|
1870
|
-
}, xn = function(e) {
|
|
1871
|
+
rt(e, "before", t, this);
|
|
1872
|
+
}, xn = function(e, t) {
|
|
1873
|
+
rt(e, "after", t, this);
|
|
1874
|
+
}, En = function(e) {
|
|
1871
1875
|
const t = e || this.currentNode;
|
|
1872
1876
|
t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t));
|
|
1873
|
-
},
|
|
1877
|
+
}, Cn = function(e, t) {
|
|
1874
1878
|
e.text.textContent = t, e.nodeObj.topic = t, this.linkDiv();
|
|
1875
|
-
},
|
|
1879
|
+
}, lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1876
1880
|
__proto__: null,
|
|
1877
|
-
addChild:
|
|
1878
|
-
beginEdit:
|
|
1879
|
-
copyNode:
|
|
1880
|
-
copyNodes:
|
|
1881
|
-
insertParent:
|
|
1882
|
-
insertSibling:
|
|
1883
|
-
moveDownNode:
|
|
1884
|
-
moveNodeAfter:
|
|
1885
|
-
moveNodeBefore:
|
|
1886
|
-
moveNodeIn:
|
|
1887
|
-
moveUpNode:
|
|
1888
|
-
removeNodes:
|
|
1889
|
-
reshapeNode:
|
|
1890
|
-
rmSubline:
|
|
1891
|
-
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
|
|
1892
1896
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1893
|
-
function
|
|
1897
|
+
function Sn(e) {
|
|
1894
1898
|
return {
|
|
1895
1899
|
nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
|
|
1896
1900
|
arrows: e.arrows,
|
|
@@ -1899,74 +1903,74 @@ function Cn(e) {
|
|
|
1899
1903
|
theme: e.theme
|
|
1900
1904
|
};
|
|
1901
1905
|
}
|
|
1902
|
-
const
|
|
1906
|
+
const Nn = function(e) {
|
|
1903
1907
|
const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
|
|
1904
1908
|
if (n.top > o.bottom || n.bottom < o.top || n.left > o.right || n.right < o.left) {
|
|
1905
|
-
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,
|
|
1906
|
-
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);
|
|
1907
1911
|
}
|
|
1908
|
-
},
|
|
1912
|
+
}, kn = function(e, t, n) {
|
|
1909
1913
|
this.clearSelection(), this.scrollIntoView(e), this.selection.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
|
|
1910
|
-
}, kn = function(e) {
|
|
1911
|
-
this.selection.select(e);
|
|
1912
1914
|
}, _n = function(e) {
|
|
1915
|
+
this.selection.select(e);
|
|
1916
|
+
}, Tn = function(e) {
|
|
1913
1917
|
this.selection.deselect(e);
|
|
1914
|
-
}, Tn = function() {
|
|
1915
|
-
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
1916
1918
|
}, Ln = function() {
|
|
1917
|
-
|
|
1919
|
+
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
1920
|
+
}, An = function() {
|
|
1921
|
+
const e = Sn(this);
|
|
1918
1922
|
return JSON.stringify(e, (t, n) => {
|
|
1919
1923
|
if (!(t === "parent" && typeof n != "string"))
|
|
1920
1924
|
return n;
|
|
1921
1925
|
});
|
|
1922
|
-
}, An = function() {
|
|
1923
|
-
return JSON.parse(this.getDataString());
|
|
1924
1926
|
}, Mn = function() {
|
|
1925
|
-
this.
|
|
1927
|
+
return JSON.parse(this.getDataString());
|
|
1926
1928
|
}, Dn = function() {
|
|
1929
|
+
this.editable = !0;
|
|
1930
|
+
}, Pn = function() {
|
|
1927
1931
|
this.editable = !1;
|
|
1928
|
-
},
|
|
1932
|
+
}, $n = function(e, t = { x: 0, y: 0 }) {
|
|
1929
1933
|
if (e < this.scaleMin || e > this.scaleMax) return;
|
|
1930
|
-
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 } =
|
|
1931
|
-
this.map.style.transform = `translate(${c -
|
|
1932
|
-
},
|
|
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() {
|
|
1933
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));
|
|
1934
1938
|
this.scaleVal = n, this.map.style.transform = "scale(" + n + ")", this.bus.fire("scale", n);
|
|
1935
|
-
},
|
|
1939
|
+
}, jn = function(e, t, n = !1) {
|
|
1936
1940
|
const { map: o, scaleVal: s, bus: i } = this, l = o.style.transform;
|
|
1937
|
-
let { x: r, y: c } =
|
|
1941
|
+
let { x: r, y: c } = Xe(l);
|
|
1938
1942
|
r += e, c += t, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
1939
1943
|
o.style.transition = "none";
|
|
1940
1944
|
}, 300)), o.style.transform = `translate(${r}px, ${c}px) scale(${s})`, i.fire("move", { dx: e, dy: t });
|
|
1941
|
-
},
|
|
1945
|
+
}, ct = (e) => {
|
|
1942
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;
|
|
1943
|
-
let a,
|
|
1944
|
-
return e.alignment === "root" ? (a = t.offsetWidth / 2 - l - r / 2,
|
|
1945
|
-
},
|
|
1946
|
-
const { map: e } = this, { dx:
|
|
1947
|
-
e.style.transform = `translate(${
|
|
1948
|
-
}, Hn = function(e) {
|
|
1949
|
-
e(this);
|
|
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);
|
|
1951
|
+
t.scrollTop = 0, t.scrollLeft = 0, e.style.transform = `translate(${n}px, ${o}px) scale(${this.scaleVal})`;
|
|
1950
1952
|
}, Bn = function(e) {
|
|
1953
|
+
e(this);
|
|
1954
|
+
}, Rn = function(e) {
|
|
1951
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());
|
|
1952
|
-
}, Rn = function() {
|
|
1953
|
-
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
1954
1956
|
}, In = function() {
|
|
1955
|
-
this.
|
|
1957
|
+
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
1956
1958
|
}, Fn = function() {
|
|
1957
|
-
this.direction =
|
|
1959
|
+
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
1958
1960
|
}, Wn = function() {
|
|
1961
|
+
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
1962
|
+
}, Kn = function() {
|
|
1959
1963
|
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
1960
|
-
},
|
|
1964
|
+
}, Gn = function(e) {
|
|
1961
1965
|
this.locale = e, this.refresh();
|
|
1962
|
-
},
|
|
1966
|
+
}, Yn = function(e, t) {
|
|
1963
1967
|
const n = e.nodeObj;
|
|
1964
1968
|
typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
1965
1969
|
const o = e.getBoundingClientRect(), s = {
|
|
1966
1970
|
x: o.left,
|
|
1967
1971
|
y: o.top
|
|
1968
1972
|
}, i = e.parentNode, l = i.children[1];
|
|
1969
|
-
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) {
|
|
1970
1974
|
const u = this.createChildren(
|
|
1971
1975
|
n.children.map((g) => this.createWrapper(g).grp)
|
|
1972
1976
|
);
|
|
@@ -1977,14 +1981,14 @@ const Sn = function(e) {
|
|
|
1977
1981
|
const r = e.getBoundingClientRect(), c = {
|
|
1978
1982
|
x: r.left,
|
|
1979
1983
|
y: r.top
|
|
1980
|
-
}, a = s.x - c.x,
|
|
1981
|
-
this.move(a,
|
|
1982
|
-
},
|
|
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) {
|
|
1983
1987
|
const n = e.nodeObj, o = e.getBoundingClientRect(), s = {
|
|
1984
1988
|
x: o.left,
|
|
1985
1989
|
y: o.top
|
|
1986
1990
|
};
|
|
1987
|
-
|
|
1991
|
+
z(n, t ?? !n.expanded), this.refresh();
|
|
1988
1992
|
const i = this.findEle(n.id).getBoundingClientRect(), l = {
|
|
1989
1993
|
x: i.left,
|
|
1990
1994
|
y: i.top
|
|
@@ -1992,32 +1996,32 @@ const Sn = function(e) {
|
|
|
1992
1996
|
this.move(r, c);
|
|
1993
1997
|
}, qn = function(e) {
|
|
1994
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();
|
|
1995
|
-
},
|
|
1999
|
+
}, Vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1996
2000
|
__proto__: null,
|
|
1997
|
-
cancelFocus:
|
|
1998
|
-
clearSelection:
|
|
1999
|
-
disableEdit:
|
|
2000
|
-
enableEdit:
|
|
2001
|
-
expandNode:
|
|
2002
|
-
expandNodeAll:
|
|
2003
|
-
focusNode:
|
|
2004
|
-
getData:
|
|
2005
|
-
getDataString:
|
|
2006
|
-
initLeft:
|
|
2007
|
-
initRight:
|
|
2008
|
-
initSide:
|
|
2009
|
-
install:
|
|
2010
|
-
move:
|
|
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,
|
|
2011
2015
|
refresh: qn,
|
|
2012
|
-
scale:
|
|
2013
|
-
scaleFit:
|
|
2014
|
-
scrollIntoView:
|
|
2015
|
-
selectNode:
|
|
2016
|
-
selectNodes:
|
|
2017
|
-
setLocale:
|
|
2018
|
-
toCenter:
|
|
2019
|
-
unselectNodes:
|
|
2020
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
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) {
|
|
2021
2025
|
return {
|
|
2022
2026
|
dom: e,
|
|
2023
2027
|
moved: !1,
|
|
@@ -2040,7 +2044,7 @@ const Sn = function(e) {
|
|
|
2040
2044
|
},
|
|
2041
2045
|
cb: null,
|
|
2042
2046
|
init(t, n) {
|
|
2043
|
-
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([
|
|
2044
2048
|
{ dom: t, evt: "pointermove", func: this.handlePointerMove },
|
|
2045
2049
|
{ dom: t, evt: "pointerleave", func: this.handleClear },
|
|
2046
2050
|
{ dom: t, evt: "pointerup", func: this.handleClear },
|
|
@@ -2052,19 +2056,19 @@ const Sn = function(e) {
|
|
|
2052
2056
|
this.moved = !1, this.pointerdown = !1;
|
|
2053
2057
|
}
|
|
2054
2058
|
};
|
|
2055
|
-
},
|
|
2056
|
-
create:
|
|
2057
|
-
},
|
|
2058
|
-
function
|
|
2059
|
+
}, Ye = {
|
|
2060
|
+
create: Xn
|
|
2061
|
+
}, Un = "#4dc4ff";
|
|
2062
|
+
function at(e, t, n, o, s, i, l, r) {
|
|
2059
2063
|
return {
|
|
2060
2064
|
x: e / 8 + n * 3 / 8 + s * 3 / 8 + l / 8,
|
|
2061
2065
|
y: t / 8 + o * 3 / 8 + i * 3 / 8 + r / 8
|
|
2062
2066
|
};
|
|
2063
2067
|
}
|
|
2064
|
-
function
|
|
2065
|
-
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));
|
|
2066
2070
|
}
|
|
2067
|
-
function
|
|
2071
|
+
function te(e, t, n, o, s) {
|
|
2068
2072
|
k(e, {
|
|
2069
2073
|
x1: t + "",
|
|
2070
2074
|
y1: n + "",
|
|
@@ -2072,15 +2076,15 @@ function ee(e, t, n, o, s) {
|
|
|
2072
2076
|
y2: s + ""
|
|
2073
2077
|
});
|
|
2074
2078
|
}
|
|
2075
|
-
function
|
|
2076
|
-
const
|
|
2077
|
-
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) {
|
|
2078
2082
|
const p = a.style;
|
|
2079
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));
|
|
2080
2084
|
}
|
|
2081
2085
|
const u = e.querySelectorAll('path[stroke="transparent"]');
|
|
2082
|
-
u.length > 0 && u[0].setAttribute("d",
|
|
2083
|
-
const g =
|
|
2086
|
+
u.length > 0 && u[0].setAttribute("d", h);
|
|
2087
|
+
const g = ie(i, l, r, c);
|
|
2084
2088
|
if (g) {
|
|
2085
2089
|
const p = `M ${g.x1} ${g.y1} L ${r} ${c} L ${g.x2} ${g.y2}`;
|
|
2086
2090
|
if (e.arrow1.setAttribute("d", p), u.length > 1 && u[1].setAttribute("d", p), a.style) {
|
|
@@ -2089,31 +2093,31 @@ function Ye(e, t, n, o, s, i, l, r, c, a) {
|
|
|
2089
2093
|
}
|
|
2090
2094
|
}
|
|
2091
2095
|
if (a.bidirectional) {
|
|
2092
|
-
const p =
|
|
2096
|
+
const p = ie(o, s, t, n);
|
|
2093
2097
|
if (p) {
|
|
2094
2098
|
const d = `M ${p.x1} ${p.y1} L ${t} ${n} L ${p.x2} ${p.y2}`;
|
|
2095
2099
|
if (e.arrow2.setAttribute("d", d), u.length > 2 && u[2].setAttribute("d", d), a.style) {
|
|
2096
|
-
const
|
|
2097
|
-
|
|
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));
|
|
2098
2102
|
}
|
|
2099
2103
|
}
|
|
2100
2104
|
}
|
|
2101
|
-
const { x:
|
|
2102
|
-
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) {
|
|
2103
2107
|
const p = e.labelEl;
|
|
2104
2108
|
p && (p.style.color = a.style.labelColor);
|
|
2105
2109
|
}
|
|
2106
|
-
|
|
2110
|
+
io(e);
|
|
2107
2111
|
}
|
|
2108
|
-
function
|
|
2109
|
-
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;
|
|
2110
2114
|
return {
|
|
2111
2115
|
w: i,
|
|
2112
2116
|
h: l,
|
|
2113
2117
|
cx: r,
|
|
2114
2118
|
cy: c,
|
|
2115
2119
|
ctrlX: a,
|
|
2116
|
-
ctrlY:
|
|
2120
|
+
ctrlY: h
|
|
2117
2121
|
};
|
|
2118
2122
|
}
|
|
2119
2123
|
function Y(e) {
|
|
@@ -2124,28 +2128,28 @@ function Y(e) {
|
|
|
2124
2128
|
y: n
|
|
2125
2129
|
};
|
|
2126
2130
|
}
|
|
2127
|
-
const
|
|
2131
|
+
const _e = function(e, t, n, o, s) {
|
|
2128
2132
|
if (!t || !n)
|
|
2129
2133
|
return;
|
|
2130
|
-
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);
|
|
2131
2135
|
if (!p) return;
|
|
2132
|
-
const d = `M ${p.x1} ${p.y1} L ${
|
|
2133
|
-
let
|
|
2136
|
+
const d = `M ${p.x1} ${p.y1} L ${v} ${m} L ${p.x2} ${p.y2}`;
|
|
2137
|
+
let f = "";
|
|
2134
2138
|
if (o.bidirectional) {
|
|
2135
|
-
const
|
|
2136
|
-
if (!
|
|
2137
|
-
|
|
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}`;
|
|
2138
2142
|
}
|
|
2139
|
-
const
|
|
2140
|
-
|
|
2141
|
-
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, {
|
|
2142
2146
|
anchor: "middle",
|
|
2143
|
-
color:
|
|
2147
|
+
color: E,
|
|
2144
2148
|
dataType: "arrow",
|
|
2145
|
-
svgId:
|
|
2149
|
+
svgId: x
|
|
2146
2150
|
});
|
|
2147
|
-
|
|
2148
|
-
},
|
|
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 = {}) {
|
|
2149
2153
|
const o = {
|
|
2150
2154
|
id: W(),
|
|
2151
2155
|
label: "Custom Link",
|
|
@@ -2161,21 +2165,21 @@ const ke = function(e, t, n, o, s) {
|
|
|
2161
2165
|
},
|
|
2162
2166
|
...n
|
|
2163
2167
|
};
|
|
2164
|
-
|
|
2168
|
+
_e(this, e, t, o), this.bus.fire("operation", {
|
|
2165
2169
|
name: "createArrow",
|
|
2166
2170
|
obj: o
|
|
2167
2171
|
});
|
|
2168
|
-
},
|
|
2169
|
-
|
|
2172
|
+
}, Qn = function(e) {
|
|
2173
|
+
he(this);
|
|
2170
2174
|
const t = { ...e, id: W() };
|
|
2171
|
-
|
|
2175
|
+
_e(this, this.findEle(t.from), this.findEle(t.to), t), this.bus.fire("operation", {
|
|
2172
2176
|
name: "createArrow",
|
|
2173
2177
|
obj: t
|
|
2174
2178
|
});
|
|
2175
|
-
},
|
|
2179
|
+
}, eo = function(e) {
|
|
2176
2180
|
let t;
|
|
2177
2181
|
if (e ? t = e : t = this.currentArrow, !t) return;
|
|
2178
|
-
|
|
2182
|
+
he(this);
|
|
2179
2183
|
const n = t.arrowObj.id;
|
|
2180
2184
|
this.arrows = this.arrows.filter((o) => o.id !== n), t.remove(), this.bus.fire("operation", {
|
|
2181
2185
|
name: "removeArrow",
|
|
@@ -2183,14 +2187,14 @@ const ke = function(e, t, n, o, s) {
|
|
|
2183
2187
|
id: n
|
|
2184
2188
|
}
|
|
2185
2189
|
});
|
|
2186
|
-
},
|
|
2190
|
+
}, to = function(e) {
|
|
2187
2191
|
this.currentArrow = e;
|
|
2188
|
-
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s =
|
|
2189
|
-
|
|
2190
|
-
},
|
|
2191
|
-
|
|
2192
|
-
},
|
|
2193
|
-
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");
|
|
2194
2198
|
return k(n, {
|
|
2195
2199
|
d: e,
|
|
2196
2200
|
stroke: t,
|
|
@@ -2199,90 +2203,90 @@ const ke = function(e, t, n, o, s) {
|
|
|
2199
2203
|
"stroke-linecap": "round",
|
|
2200
2204
|
"stroke-linejoin": "round"
|
|
2201
2205
|
}), n;
|
|
2202
|
-
},
|
|
2203
|
-
const n = document.createElementNS(
|
|
2206
|
+
}, oo = function(e, t) {
|
|
2207
|
+
const n = document.createElementNS(M, "g");
|
|
2204
2208
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
2205
|
-
const o =
|
|
2209
|
+
const o = fe(e.line.getAttribute("d"), t);
|
|
2206
2210
|
n.appendChild(o);
|
|
2207
|
-
const s =
|
|
2211
|
+
const s = fe(e.arrow1.getAttribute("d"), t);
|
|
2208
2212
|
if (n.appendChild(s), e.arrow2.getAttribute("d")) {
|
|
2209
|
-
const i =
|
|
2213
|
+
const i = fe(e.arrow2.getAttribute("d"), t);
|
|
2210
2214
|
n.appendChild(i);
|
|
2211
2215
|
}
|
|
2212
2216
|
e.insertBefore(n, e.firstChild);
|
|
2213
|
-
},
|
|
2217
|
+
}, so = function(e) {
|
|
2214
2218
|
const t = e.querySelector(".arrow-highlight");
|
|
2215
2219
|
t && t.remove();
|
|
2216
|
-
},
|
|
2220
|
+
}, io = function(e) {
|
|
2217
2221
|
const t = e.querySelector(".arrow-highlight");
|
|
2218
2222
|
if (!t) return;
|
|
2219
2223
|
const n = t.querySelectorAll("path");
|
|
2220
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"));
|
|
2221
|
-
},
|
|
2222
|
-
e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow &&
|
|
2223
|
-
},
|
|
2224
|
-
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;
|
|
2225
2229
|
if (!u) return;
|
|
2226
|
-
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l),
|
|
2227
|
-
let { x:
|
|
2228
|
-
i.style.cssText = `top:${d}px;left:${p}px;`, l.style.cssText = `top:${
|
|
2229
|
-
p = p +
|
|
2230
|
-
const
|
|
2231
|
-
|
|
2232
|
-
}), e.helper2.init(
|
|
2233
|
-
|
|
2234
|
-
const
|
|
2235
|
-
|
|
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);
|
|
2236
2240
|
});
|
|
2237
2241
|
};
|
|
2238
|
-
function
|
|
2242
|
+
function ro() {
|
|
2239
2243
|
this.linkSvgGroup.innerHTML = "";
|
|
2240
2244
|
for (let e = 0; e < this.arrows.length; e++) {
|
|
2241
2245
|
const t = this.arrows[e];
|
|
2242
2246
|
try {
|
|
2243
|
-
|
|
2247
|
+
_e(this, this.findEle(t.from), this.findEle(t.to), t, !0);
|
|
2244
2248
|
} catch {
|
|
2245
2249
|
}
|
|
2246
2250
|
}
|
|
2247
2251
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
2248
2252
|
}
|
|
2249
|
-
function
|
|
2250
|
-
|
|
2253
|
+
function lo(e) {
|
|
2254
|
+
he(this), e && e.labelEl && Qe(this, e.labelEl, e.arrowObj);
|
|
2251
2255
|
}
|
|
2252
|
-
function
|
|
2253
|
-
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));
|
|
2254
2258
|
}
|
|
2255
|
-
const
|
|
2259
|
+
const ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2256
2260
|
__proto__: null,
|
|
2257
|
-
createArrow:
|
|
2258
|
-
createArrowFrom:
|
|
2259
|
-
editArrowLabel:
|
|
2260
|
-
removeArrow:
|
|
2261
|
-
renderArrow:
|
|
2262
|
-
selectArrow:
|
|
2263
|
-
tidyArrow:
|
|
2264
|
-
unselectArrow:
|
|
2265
|
-
}, 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) {
|
|
2266
2270
|
if (e.length === 0) throw new Error("No selected node.");
|
|
2267
2271
|
if (e.length === 1) {
|
|
2268
2272
|
const c = e[0].nodeObj, a = e[0].nodeObj.parent;
|
|
2269
2273
|
if (!a) throw new Error("Can not select root node.");
|
|
2270
|
-
const
|
|
2274
|
+
const h = a.children.findIndex((u) => c === u);
|
|
2271
2275
|
return {
|
|
2272
2276
|
parent: a.id,
|
|
2273
|
-
start:
|
|
2274
|
-
end:
|
|
2277
|
+
start: h,
|
|
2278
|
+
end: h
|
|
2275
2279
|
};
|
|
2276
2280
|
}
|
|
2277
2281
|
let t = 0;
|
|
2278
2282
|
const n = e.map((c) => {
|
|
2279
2283
|
let a = c.nodeObj;
|
|
2280
|
-
const
|
|
2284
|
+
const h = [];
|
|
2281
2285
|
for (; a.parent; ) {
|
|
2282
|
-
const u = a.parent,
|
|
2283
|
-
a = u,
|
|
2286
|
+
const u = a.parent, v = u.children?.indexOf(a);
|
|
2287
|
+
a = u, h.unshift({ node: a, index: v });
|
|
2284
2288
|
}
|
|
2285
|
-
return
|
|
2289
|
+
return h.length > t && (t = h.length), h;
|
|
2286
2290
|
});
|
|
2287
2291
|
let o = 0;
|
|
2288
2292
|
e: for (; o < t; o++) {
|
|
@@ -2299,11 +2303,11 @@ const co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2299
2303
|
start: i,
|
|
2300
2304
|
end: l
|
|
2301
2305
|
};
|
|
2302
|
-
},
|
|
2303
|
-
const t = document.createElementNS(
|
|
2306
|
+
}, fo = function(e) {
|
|
2307
|
+
const t = document.createElementNS(M, "g");
|
|
2304
2308
|
return t.setAttribute("id", e), t;
|
|
2305
2309
|
}, qe = function(e, t) {
|
|
2306
|
-
const n = document.createElementNS(
|
|
2310
|
+
const n = document.createElementNS(M, "path");
|
|
2307
2311
|
return k(n, {
|
|
2308
2312
|
d: e,
|
|
2309
2313
|
stroke: t || "#666",
|
|
@@ -2311,69 +2315,69 @@ const co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2311
2315
|
"stroke-linecap": "round",
|
|
2312
2316
|
"stroke-width": "2"
|
|
2313
2317
|
}), n;
|
|
2314
|
-
},
|
|
2318
|
+
}, uo = (e) => e.parentElement.parentElement, po = function(e, { parent: t, start: n }) {
|
|
2315
2319
|
const o = e.findEle(t), s = o.nodeObj;
|
|
2316
2320
|
let i;
|
|
2317
2321
|
return s.parent ? i = o.closest("me-main").className : i = e.findEle(s.children[n].id).closest("me-main").className, i;
|
|
2318
|
-
},
|
|
2319
|
-
const { id: n, label: o, parent: s, start: i, end: l, style: r } = t, { nodes: c, theme: a, summarySvg:
|
|
2320
|
-
let m = 1 / 0, p = 0, d = 0,
|
|
2321
|
-
for (let
|
|
2322
|
-
const
|
|
2323
|
-
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)
|
|
2324
2328
|
return e.removeSummary(n), null;
|
|
2325
|
-
const
|
|
2326
|
-
|
|
2327
|
-
}
|
|
2328
|
-
let
|
|
2329
|
-
const
|
|
2330
|
-
|
|
2331
|
-
const
|
|
2332
|
-
return
|
|
2333
|
-
},
|
|
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 = {}) {
|
|
2334
2338
|
if (!this.currentNodes) return;
|
|
2335
|
-
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);
|
|
2336
2340
|
n.push(r), this.editSummary(c), o.fire("operation", {
|
|
2337
2341
|
name: "createSummary",
|
|
2338
2342
|
obj: r
|
|
2339
2343
|
});
|
|
2340
|
-
},
|
|
2344
|
+
}, mo = function(e) {
|
|
2341
2345
|
const t = W(), n = { ...e, id: t };
|
|
2342
|
-
|
|
2346
|
+
Te(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
2343
2347
|
name: "createSummary",
|
|
2344
2348
|
obj: n
|
|
2345
2349
|
});
|
|
2346
|
-
},
|
|
2350
|
+
}, yo = function(e) {
|
|
2347
2351
|
const t = this.summaries.findIndex((n) => n.id === e);
|
|
2348
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", {
|
|
2349
2353
|
name: "removeSummary",
|
|
2350
2354
|
obj: { id: e }
|
|
2351
2355
|
});
|
|
2352
|
-
},
|
|
2356
|
+
}, vo = function(e) {
|
|
2353
2357
|
const t = e.labelEl;
|
|
2354
2358
|
t && t.classList.add("selected"), this.currentSummary = e;
|
|
2355
|
-
}, vo = function() {
|
|
2356
|
-
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
|
|
2357
2359
|
}, bo = function() {
|
|
2360
|
+
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
|
|
2361
|
+
}, wo = function() {
|
|
2358
2362
|
this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
|
|
2359
2363
|
try {
|
|
2360
|
-
|
|
2364
|
+
Te(this, e);
|
|
2361
2365
|
} catch {
|
|
2362
2366
|
}
|
|
2363
2367
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
2364
|
-
},
|
|
2365
|
-
e && e.labelEl &&
|
|
2366
|
-
},
|
|
2368
|
+
}, xo = function(e) {
|
|
2369
|
+
e && e.labelEl && Qe(this, e.labelEl, e.summaryObj);
|
|
2370
|
+
}, Eo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2367
2371
|
__proto__: null,
|
|
2368
|
-
createSummary:
|
|
2369
|
-
createSummaryFrom:
|
|
2370
|
-
editSummary:
|
|
2371
|
-
removeSummary:
|
|
2372
|
-
renderSummary:
|
|
2373
|
-
selectSummary:
|
|
2374
|
-
unselectSummary:
|
|
2372
|
+
createSummary: go,
|
|
2373
|
+
createSummaryFrom: mo,
|
|
2374
|
+
editSummary: xo,
|
|
2375
|
+
removeSummary: yo,
|
|
2376
|
+
renderSummary: wo,
|
|
2377
|
+
selectSummary: vo,
|
|
2378
|
+
unselectSummary: bo
|
|
2375
2379
|
}, Symbol.toStringTag, { value: "Module" })), T = "http://www.w3.org/2000/svg";
|
|
2376
|
-
function
|
|
2380
|
+
function Co(e, t) {
|
|
2377
2381
|
const n = document.createElementNS(T, "svg");
|
|
2378
2382
|
return k(n, {
|
|
2379
2383
|
version: "1.1",
|
|
@@ -2382,10 +2386,10 @@ function Eo(e, t) {
|
|
|
2382
2386
|
width: t
|
|
2383
2387
|
}), n;
|
|
2384
2388
|
}
|
|
2385
|
-
function
|
|
2389
|
+
function So(e, t) {
|
|
2386
2390
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2387
2391
|
}
|
|
2388
|
-
function
|
|
2392
|
+
function No(e, t, n, o) {
|
|
2389
2393
|
const s = document.createElementNS(T, "g");
|
|
2390
2394
|
let i = "";
|
|
2391
2395
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
@@ -2393,7 +2397,7 @@ function So(e, t, n, o) {
|
|
|
2393
2397
|
const a = document.createElementNS(T, "text");
|
|
2394
2398
|
k(a, {
|
|
2395
2399
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2396
|
-
y: o + parseInt(t.paddingTop) +
|
|
2400
|
+
y: o + parseInt(t.paddingTop) + So(t.lineHeight, t.fontSize) * (c + 1) + parseFloat(t.fontSize) * (c + 1) + "",
|
|
2397
2401
|
"text-anchor": "start",
|
|
2398
2402
|
"font-family": t.fontFamily,
|
|
2399
2403
|
"font-size": `${t.fontSize}`,
|
|
@@ -2402,7 +2406,7 @@ function So(e, t, n, o) {
|
|
|
2402
2406
|
}), a.innerHTML = r, s.appendChild(a);
|
|
2403
2407
|
}), s;
|
|
2404
2408
|
}
|
|
2405
|
-
function
|
|
2409
|
+
function ko(e, t, n, o) {
|
|
2406
2410
|
let s = "";
|
|
2407
2411
|
e.nodeObj?.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
2408
2412
|
const i = document.createElementNS(T, "foreignObject");
|
|
@@ -2418,8 +2422,8 @@ function No(e, t, n, o) {
|
|
|
2418
2422
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
2419
2423
|
}), l.innerHTML = s, i.appendChild(l), i;
|
|
2420
2424
|
}
|
|
2421
|
-
function
|
|
2422
|
-
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");
|
|
2423
2427
|
return k(i, {
|
|
2424
2428
|
x: o + "",
|
|
2425
2429
|
y: s + "",
|
|
@@ -2432,8 +2436,8 @@ function ko(e, t) {
|
|
|
2432
2436
|
"stroke-width": n.borderWidth
|
|
2433
2437
|
}), i;
|
|
2434
2438
|
}
|
|
2435
|
-
function
|
|
2436
|
-
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");
|
|
2437
2441
|
k(l, {
|
|
2438
2442
|
x: s + "",
|
|
2439
2443
|
y: i + "",
|
|
@@ -2448,10 +2452,10 @@ function te(e, t, n = !1) {
|
|
|
2448
2452
|
const r = document.createElementNS(T, "g");
|
|
2449
2453
|
r.appendChild(l);
|
|
2450
2454
|
let c;
|
|
2451
|
-
return n ? c =
|
|
2455
|
+
return n ? c = ko(t, o, s, i) : c = No(t, o, s, i), r.appendChild(c), r;
|
|
2452
2456
|
}
|
|
2453
|
-
function
|
|
2454
|
-
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");
|
|
2455
2459
|
return k(l, {
|
|
2456
2460
|
x: o + "",
|
|
2457
2461
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -2462,8 +2466,8 @@ function _o(e, t) {
|
|
|
2462
2466
|
fill: `${n.color}`
|
|
2463
2467
|
}), l.innerHTML = t.textContent, i.appendChild(l), i.setAttribute("href", t.href), i;
|
|
2464
2468
|
}
|
|
2465
|
-
function
|
|
2466
|
-
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");
|
|
2467
2471
|
return k(i, {
|
|
2468
2472
|
x: o + "",
|
|
2469
2473
|
y: s + "",
|
|
@@ -2472,8 +2476,8 @@ function To(e, t) {
|
|
|
2472
2476
|
href: t.src
|
|
2473
2477
|
}), i;
|
|
2474
2478
|
}
|
|
2475
|
-
const
|
|
2476
|
-
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");
|
|
2477
2481
|
k(r, {
|
|
2478
2482
|
x: "0",
|
|
2479
2483
|
y: "0",
|
|
@@ -2481,31 +2485,31 @@ const ne = 100, Lo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2481
2485
|
height: `${o}`,
|
|
2482
2486
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2483
2487
|
}), i.appendChild(r), n.querySelectorAll(".subLines").forEach((u) => {
|
|
2484
|
-
const g = u.cloneNode(!0), { offsetLeft:
|
|
2485
|
-
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);
|
|
2486
2490
|
});
|
|
2487
2491
|
const c = n.querySelector(".lines")?.cloneNode(!0);
|
|
2488
2492
|
c && l.appendChild(c);
|
|
2489
2493
|
const a = n.querySelector(".topiclinks")?.cloneNode(!0);
|
|
2490
2494
|
a && l.appendChild(a);
|
|
2491
|
-
const
|
|
2492
|
-
return
|
|
2493
|
-
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)));
|
|
2494
2498
|
}), n.querySelectorAll(".tags > span").forEach((u) => {
|
|
2495
|
-
l.appendChild(
|
|
2499
|
+
l.appendChild(ne(e, u));
|
|
2496
2500
|
}), n.querySelectorAll(".icons > span").forEach((u) => {
|
|
2497
|
-
l.appendChild(
|
|
2501
|
+
l.appendChild(ne(e, u));
|
|
2498
2502
|
}), n.querySelectorAll(".hyper-link").forEach((u) => {
|
|
2499
|
-
l.appendChild(_o(e, u));
|
|
2500
|
-
}), n.querySelectorAll("img").forEach((u) => {
|
|
2501
2503
|
l.appendChild(To(e, u));
|
|
2504
|
+
}), n.querySelectorAll("img").forEach((u) => {
|
|
2505
|
+
l.appendChild(Lo(e, u));
|
|
2502
2506
|
}), k(l, {
|
|
2503
|
-
x:
|
|
2504
|
-
y:
|
|
2507
|
+
x: oe + "",
|
|
2508
|
+
y: oe + "",
|
|
2505
2509
|
overflow: "visible"
|
|
2506
2510
|
}), i.appendChild(l), i;
|
|
2507
|
-
},
|
|
2508
|
-
function
|
|
2511
|
+
}, Do = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Ao + e.outerHTML);
|
|
2512
|
+
function Po(e) {
|
|
2509
2513
|
return new Promise((t, n) => {
|
|
2510
2514
|
const o = new FileReader();
|
|
2511
2515
|
o.onload = (s) => {
|
|
@@ -2515,11 +2519,11 @@ function Do(e) {
|
|
|
2515
2519
|
}, o.readAsDataURL(e);
|
|
2516
2520
|
});
|
|
2517
2521
|
}
|
|
2518
|
-
const
|
|
2519
|
-
const n =
|
|
2522
|
+
const $o = function(e = !1, t) {
|
|
2523
|
+
const n = Mo(this, e), o = Do(n, t);
|
|
2520
2524
|
return new Blob([o], { type: "image/svg+xml" });
|
|
2521
|
-
},
|
|
2522
|
-
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);
|
|
2523
2527
|
return new Promise((s, i) => {
|
|
2524
2528
|
const l = new Image();
|
|
2525
2529
|
l.setAttribute("crossOrigin", "anonymous"), l.onload = () => {
|
|
@@ -2527,66 +2531,66 @@ const Po = function(e = !1, t) {
|
|
|
2527
2531
|
r.width = l.width, r.height = l.height, r.getContext("2d").drawImage(l, 0, 0), r.toBlob(s, "image/png", 1);
|
|
2528
2532
|
}, l.src = o, l.onerror = i;
|
|
2529
2533
|
});
|
|
2530
|
-
},
|
|
2534
|
+
}, jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2531
2535
|
__proto__: null,
|
|
2532
|
-
exportPng:
|
|
2533
|
-
exportSvg:
|
|
2536
|
+
exportPng: Oo,
|
|
2537
|
+
exportSvg: $o
|
|
2534
2538
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2535
|
-
function
|
|
2539
|
+
function Ho(e, t) {
|
|
2536
2540
|
return async function(...n) {
|
|
2537
2541
|
const o = this.before[t];
|
|
2538
2542
|
o && !await o.apply(this, n) || e.apply(this, n);
|
|
2539
2543
|
};
|
|
2540
2544
|
}
|
|
2541
|
-
const
|
|
2542
|
-
for (let e = 0; e <
|
|
2543
|
-
const t =
|
|
2544
|
-
|
|
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);
|
|
2545
2549
|
}
|
|
2546
|
-
const
|
|
2547
|
-
getObjById:
|
|
2548
|
-
generateNewObj:
|
|
2549
|
-
layout:
|
|
2550
|
-
linkDiv:
|
|
2551
|
-
editTopic:
|
|
2552
|
-
createWrapper:
|
|
2553
|
-
createParent:
|
|
2554
|
-
createChildren:
|
|
2555
|
-
createTopic:
|
|
2556
|
-
findEle:
|
|
2557
|
-
changeTheme:
|
|
2558
|
-
...
|
|
2559
|
-
...
|
|
2560
|
-
...
|
|
2561
|
-
...
|
|
2562
|
-
...
|
|
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,
|
|
2563
2567
|
init(e) {
|
|
2564
2568
|
if (e = JSON.parse(JSON.stringify(e)), !e || !e.nodeData) return new Error("MindElixir: `data` is required");
|
|
2565
|
-
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();
|
|
2566
2570
|
},
|
|
2567
2571
|
destroy() {
|
|
2568
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;
|
|
2569
2573
|
}
|
|
2570
2574
|
};
|
|
2571
|
-
function
|
|
2572
|
-
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;
|
|
2573
2577
|
const u = e + o / 2;
|
|
2574
2578
|
let g;
|
|
2575
|
-
c ===
|
|
2576
|
-
const
|
|
2577
|
-
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}`;
|
|
2578
2582
|
}
|
|
2579
|
-
function
|
|
2580
|
-
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"));
|
|
2581
2585
|
let u = 0, g = 0;
|
|
2582
2586
|
a ? u = e + o / 2 : u = e + o;
|
|
2583
|
-
const
|
|
2587
|
+
const v = s + r;
|
|
2584
2588
|
let m = 0, p = 0, d = 0;
|
|
2585
|
-
const
|
|
2586
|
-
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}`);
|
|
2587
2591
|
}
|
|
2588
|
-
const
|
|
2589
|
-
function
|
|
2592
|
+
const Fo = "5.3.4";
|
|
2593
|
+
function Wo(e) {
|
|
2590
2594
|
return {
|
|
2591
2595
|
x: 0,
|
|
2592
2596
|
y: 0,
|
|
@@ -2602,7 +2606,7 @@ function Fo(e) {
|
|
|
2602
2606
|
};
|
|
2603
2607
|
}
|
|
2604
2608
|
const G = document;
|
|
2605
|
-
function
|
|
2609
|
+
function P({
|
|
2606
2610
|
el: e,
|
|
2607
2611
|
direction: t,
|
|
2608
2612
|
locale: n,
|
|
@@ -2613,45 +2617,45 @@ function $({
|
|
|
2613
2617
|
keypress: r,
|
|
2614
2618
|
mouseSelectionButton: c,
|
|
2615
2619
|
selectionContainer: a,
|
|
2616
|
-
before:
|
|
2620
|
+
before: h,
|
|
2617
2621
|
newTopicName: u,
|
|
2618
2622
|
allowUndo: g,
|
|
2619
|
-
generateMainBranch:
|
|
2623
|
+
generateMainBranch: v,
|
|
2620
2624
|
generateSubBranch: m,
|
|
2621
2625
|
overflowHidden: p,
|
|
2622
2626
|
theme: d,
|
|
2623
|
-
alignment:
|
|
2624
|
-
scaleSensitivity:
|
|
2625
|
-
scaleMax:
|
|
2626
|
-
scaleMin:
|
|
2627
|
-
handleWheel:
|
|
2628
|
-
markdown:
|
|
2629
|
-
imageProxy:
|
|
2627
|
+
alignment: f,
|
|
2628
|
+
scaleSensitivity: y,
|
|
2629
|
+
scaleMax: w,
|
|
2630
|
+
scaleMin: S,
|
|
2631
|
+
handleWheel: E,
|
|
2632
|
+
markdown: x,
|
|
2633
|
+
imageProxy: b
|
|
2630
2634
|
}) {
|
|
2631
2635
|
let C = null;
|
|
2632
2636
|
const N = Object.prototype.toString.call(e);
|
|
2633
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");
|
|
2634
|
-
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";
|
|
2635
2639
|
const L = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2636
|
-
this.theme = d || (L.matches ?
|
|
2637
|
-
const
|
|
2638
|
-
|
|
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));
|
|
2639
2643
|
}
|
|
2640
|
-
|
|
2641
|
-
Object.defineProperty(
|
|
2644
|
+
P.prototype = Bo;
|
|
2645
|
+
Object.defineProperty(P.prototype, "currentNode", {
|
|
2642
2646
|
get() {
|
|
2643
2647
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
2644
2648
|
},
|
|
2645
2649
|
enumerable: !0
|
|
2646
2650
|
});
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
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) => ({
|
|
2655
2659
|
nodeData: {
|
|
2656
2660
|
id: W(),
|
|
2657
2661
|
topic: e || "new topic",
|
|
@@ -2659,5 +2663,5 @@ $.new = (e) => ({
|
|
|
2659
2663
|
}
|
|
2660
2664
|
});
|
|
2661
2665
|
export {
|
|
2662
|
-
|
|
2666
|
+
P as default
|
|
2663
2667
|
};
|