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