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