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