mind-elixir 5.11.0 → 5.11.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +874 -863
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +598 -587
- package/dist/types/utils/pubsub.d.ts +4 -0
- package/package.json +1 -1
package/dist/MindElixirLite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Yn = 0, Bn = 1, Wn = 2, nt = {
|
|
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 Wn = 0, Rn = 1, Xn = 2, rt = {
|
|
|
25
25
|
"--panel-border-color": "#eaeaea",
|
|
26
26
|
"--map-padding": "50px 80px"
|
|
27
27
|
}
|
|
28
|
-
},
|
|
28
|
+
}, ot = {
|
|
29
29
|
name: "Dark",
|
|
30
30
|
type: "dark",
|
|
31
31
|
palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
|
|
@@ -53,48 +53,48 @@ const Wn = 0, Rn = 1, Xn = 2, rt = {
|
|
|
53
53
|
"--map-padding": "50px 80px"
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
function
|
|
56
|
+
function Nt(t) {
|
|
57
57
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
58
58
|
}
|
|
59
|
-
const
|
|
59
|
+
const _ = function(t, e) {
|
|
60
60
|
if (e.id === t)
|
|
61
61
|
return e;
|
|
62
62
|
if (e.children && e.children.length) {
|
|
63
63
|
for (let n = 0; n < e.children.length; n++) {
|
|
64
|
-
const o =
|
|
64
|
+
const o = _(t, e.children[n]);
|
|
65
65
|
if (o) return o;
|
|
66
66
|
}
|
|
67
67
|
return null;
|
|
68
68
|
} else
|
|
69
69
|
return null;
|
|
70
|
-
},
|
|
70
|
+
}, st = (t, e) => {
|
|
71
71
|
if (t.parent = e, t.children)
|
|
72
72
|
for (let n = 0; n < t.children.length; n++)
|
|
73
|
-
|
|
74
|
-
},
|
|
73
|
+
st(t.children[n], t);
|
|
74
|
+
}, wt = (t, e, n) => {
|
|
75
75
|
t.expanded = e, t.children && t.children.forEach((o) => {
|
|
76
|
-
|
|
76
|
+
wt(o, e);
|
|
77
77
|
});
|
|
78
78
|
};
|
|
79
|
-
function
|
|
80
|
-
const s = n - t, i = o - e, c = Math.atan2(i, s) * 180 / Math.PI,
|
|
79
|
+
function j(t, e, n, o) {
|
|
80
|
+
const s = n - t, i = o - e, c = Math.atan2(i, s) * 180 / Math.PI, a = 12, d = 30, h = (c + 180 - d) * Math.PI / 180, f = (c + 180 + d) * Math.PI / 180;
|
|
81
81
|
return {
|
|
82
|
-
x1: n + Math.cos(h) *
|
|
83
|
-
y1: o + Math.sin(h) *
|
|
84
|
-
x2: n + Math.cos(f) *
|
|
85
|
-
y2: o + Math.sin(f) *
|
|
82
|
+
x1: n + Math.cos(h) * a,
|
|
83
|
+
y1: o + Math.sin(h) * a,
|
|
84
|
+
x2: n + Math.cos(f) * a,
|
|
85
|
+
y2: o + Math.sin(f) * a
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function R() {
|
|
89
89
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substring(2)).substring(2, 18);
|
|
90
90
|
}
|
|
91
|
-
const
|
|
92
|
-
const t =
|
|
91
|
+
const Pt = function() {
|
|
92
|
+
const t = R();
|
|
93
93
|
return {
|
|
94
94
|
topic: this.newTopicName,
|
|
95
95
|
id: t
|
|
96
96
|
};
|
|
97
|
-
},
|
|
97
|
+
}, N = (t, e) => {
|
|
98
98
|
let n = 0, o = 0;
|
|
99
99
|
for (; e && e !== t; )
|
|
100
100
|
n += e.offsetLeft, o += e.offsetTop, e = e.offsetParent;
|
|
@@ -102,10 +102,10 @@ const Ht = function() {
|
|
|
102
102
|
}, M = (t, e) => {
|
|
103
103
|
for (const n in e)
|
|
104
104
|
t.setAttribute(n, e[n]);
|
|
105
|
-
},
|
|
105
|
+
}, G = (t) => t ? t.tagName === "ME-TPC" : !1, it = (t) => {
|
|
106
106
|
const e = /translate3d\(([^,]+),\s*([^,]+)/, n = t.match(e);
|
|
107
107
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
108
|
-
},
|
|
108
|
+
}, vt = function(t) {
|
|
109
109
|
for (let e = 0; e < t.length; e++) {
|
|
110
110
|
const { dom: n, evt: o, func: s } = t[e];
|
|
111
111
|
n.addEventListener(o, s);
|
|
@@ -116,31 +116,31 @@ const Ht = function() {
|
|
|
116
116
|
o.removeEventListener(s, i);
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
|
-
},
|
|
119
|
+
}, ht = (t, e) => {
|
|
120
120
|
const n = t.x - e.x, o = t.y - e.y;
|
|
121
121
|
return Math.sqrt(n * n + o * o);
|
|
122
|
-
},
|
|
122
|
+
}, $t = function(t, e) {
|
|
123
123
|
if (!e)
|
|
124
|
-
return
|
|
124
|
+
return K(t), t;
|
|
125
125
|
let n = t.querySelector(".insert-preview");
|
|
126
126
|
const o = `insert-preview ${e} show`;
|
|
127
127
|
return n || (n = document.createElement("div"), t.appendChild(n)), n.className = o, t;
|
|
128
|
-
},
|
|
128
|
+
}, K = function(t) {
|
|
129
129
|
if (!t) return;
|
|
130
130
|
const e = t.querySelectorAll(".insert-preview");
|
|
131
131
|
for (const n of e || [])
|
|
132
132
|
n.remove();
|
|
133
|
-
},
|
|
133
|
+
}, ft = function(t, e) {
|
|
134
134
|
for (const n of e) {
|
|
135
135
|
const o = n.parentElement.parentElement.contains(t);
|
|
136
136
|
if (!(t && t.tagName === "ME-TPC" && t !== n && !o && t.nodeObj.parent)) return !1;
|
|
137
137
|
}
|
|
138
138
|
return !0;
|
|
139
|
-
},
|
|
139
|
+
}, Ht = function(t) {
|
|
140
140
|
const e = document.createElement("div");
|
|
141
141
|
return e.className = "mind-elixir-ghost", t.container.appendChild(e), e;
|
|
142
142
|
};
|
|
143
|
-
class
|
|
143
|
+
class It {
|
|
144
144
|
mind;
|
|
145
145
|
isMoving = !1;
|
|
146
146
|
interval = null;
|
|
@@ -157,28 +157,28 @@ class Yt {
|
|
|
157
157
|
this.isMoving = !1, this.interval && (clearInterval(this.interval), this.interval = null);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function Ot(t) {
|
|
161
161
|
return {
|
|
162
162
|
isDragging: !1,
|
|
163
163
|
insertType: null,
|
|
164
164
|
meet: null,
|
|
165
|
-
ghost:
|
|
166
|
-
edgeMoveController: new
|
|
165
|
+
ghost: Ht(t),
|
|
166
|
+
edgeMoveController: new It(t),
|
|
167
167
|
startX: 0,
|
|
168
168
|
startY: 0,
|
|
169
169
|
pointerId: null
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
|
-
const
|
|
173
|
-
function
|
|
172
|
+
const Yt = 5;
|
|
173
|
+
function ut(t, e, n, o = !1) {
|
|
174
174
|
if (t.spacePressed) return !1;
|
|
175
175
|
const s = n.target;
|
|
176
|
-
return s?.tagName !== "ME-TPC" || !s.nodeObj.parent ? !1 : (e.startX = n.clientX, e.startY = n.clientY, e.pointerId = n.pointerId, t.dragged = t.currentNodes, o &&
|
|
176
|
+
return s?.tagName !== "ME-TPC" || !s.nodeObj.parent ? !1 : (e.startX = n.clientX, e.startY = n.clientY, e.pointerId = n.pointerId, t.dragged = t.currentNodes, o && xt(t, e), !0);
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function bt(t, e, n) {
|
|
179
179
|
t.style.transform = `translate(${e - 10}px, ${n - 10}px)`, t.style.display = "block";
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function xt(t, e) {
|
|
182
182
|
const { dragged: n } = t;
|
|
183
183
|
if (!n) return;
|
|
184
184
|
const o = document.activeElement;
|
|
@@ -187,54 +187,54 @@ function Et(t, e) {
|
|
|
187
187
|
s.parentElement.parentElement.style.opacity = "0.5";
|
|
188
188
|
t.panHelper.clear();
|
|
189
189
|
}
|
|
190
|
-
function
|
|
190
|
+
function Bt(t, e, n) {
|
|
191
191
|
const { dragged: o } = t;
|
|
192
192
|
if (!o || e.pointerId !== n.pointerId) return;
|
|
193
193
|
const s = n.clientX - e.startX, i = n.clientY - e.startY, r = Math.sqrt(s * s + i * i);
|
|
194
|
-
if (!e.isDragging && r >
|
|
194
|
+
if (!e.isDragging && r > Yt && xt(t, e), !e.isDragging) return;
|
|
195
195
|
const c = t.container.getBoundingClientRect();
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
if (
|
|
199
|
-
e.meet =
|
|
200
|
-
const h =
|
|
196
|
+
bt(e.ghost, n.clientX - c.x, n.clientY - c.y), n.clientX < c.x + 50 ? e.edgeMoveController.move(1, 0) : n.clientX > c.x + c.width - 50 ? e.edgeMoveController.move(-1, 0) : n.clientY < c.y + 50 ? e.edgeMoveController.move(0, 1) : n.clientY > c.y + c.height - 50 ? e.edgeMoveController.move(0, -1) : e.edgeMoveController.stop(), K(e.meet);
|
|
197
|
+
const a = 12 * t.scaleVal, d = document.elementFromPoint(n.clientX, n.clientY - a);
|
|
198
|
+
if (ft(d, o)) {
|
|
199
|
+
e.meet = d;
|
|
200
|
+
const h = d.getBoundingClientRect(), f = h.y;
|
|
201
201
|
n.clientY > f + h.height ? e.insertType = "after" : e.insertType = "in";
|
|
202
202
|
} else {
|
|
203
|
-
const h = document.elementFromPoint(n.clientX, n.clientY +
|
|
204
|
-
if (
|
|
203
|
+
const h = document.elementFromPoint(n.clientX, n.clientY + a);
|
|
204
|
+
if (ft(h, o)) {
|
|
205
205
|
e.meet = h;
|
|
206
206
|
const p = h.getBoundingClientRect().y;
|
|
207
207
|
n.clientY < p ? e.insertType = "before" : e.insertType = "in";
|
|
208
208
|
} else
|
|
209
209
|
e.insertType = null, e.meet = null;
|
|
210
210
|
}
|
|
211
|
-
e.meet &&
|
|
211
|
+
e.meet && $t(e.meet, e.insertType);
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function Wt(t, e, n) {
|
|
214
214
|
const { dragged: o } = t;
|
|
215
215
|
if (!(!o || e.pointerId !== n.pointerId)) {
|
|
216
216
|
e.edgeMoveController.stop();
|
|
217
217
|
for (const s of o)
|
|
218
218
|
s.parentElement.parentElement.style.opacity = "1";
|
|
219
|
-
e.ghost.style.display = "none", e.ghost.innerHTML = "", e.isDragging && e.meet && (
|
|
219
|
+
e.ghost.style.display = "none", e.ghost.innerHTML = "", e.isDragging && e.meet && (K(e.meet), e.insertType === "before" ? t.moveNodeBefore(o, e.meet) : e.insertType === "after" ? t.moveNodeAfter(o, e.meet) : e.insertType === "in" && t.moveNodeIn(o, e.meet)), t.dragged = null, e.isDragging = !1, e.insertType = null, e.meet = null, e.pointerId = null;
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function Q(t, e) {
|
|
223
223
|
const { dragged: n } = t;
|
|
224
224
|
if (n) {
|
|
225
225
|
e.edgeMoveController.stop();
|
|
226
226
|
for (const o of n)
|
|
227
227
|
o.parentElement.parentElement.style.opacity = "1";
|
|
228
|
-
e.meet &&
|
|
228
|
+
e.meet && K(e.meet), e.ghost.style.display = "none", e.ghost.innerHTML = "", t.dragged = null, e.isDragging = !1, e.insertType = null, e.meet = null, e.pointerId = null;
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
const
|
|
231
|
+
const B = {
|
|
232
232
|
LHS: "lhs",
|
|
233
233
|
RHS: "rhs"
|
|
234
|
-
},
|
|
234
|
+
}, Rt = function() {
|
|
235
235
|
this.nodes.innerHTML = "";
|
|
236
236
|
const t = this.createTopic(this.nodeData);
|
|
237
|
-
|
|
237
|
+
Et.call(this, t, this.nodeData), t.draggable = !1;
|
|
238
238
|
const e = document.createElement("me-root");
|
|
239
239
|
e.appendChild(t);
|
|
240
240
|
const n = this.nodeData.children || [];
|
|
@@ -244,29 +244,29 @@ const G = {
|
|
|
244
244
|
i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
|
|
245
245
|
});
|
|
246
246
|
}
|
|
247
|
-
|
|
248
|
-
},
|
|
247
|
+
Xt(this, n, e);
|
|
248
|
+
}, Xt = function(t, e, n) {
|
|
249
249
|
const o = document.createElement("me-main");
|
|
250
|
-
o.className =
|
|
250
|
+
o.className = B.LHS;
|
|
251
251
|
const s = document.createElement("me-main");
|
|
252
|
-
s.className =
|
|
252
|
+
s.className = B.RHS;
|
|
253
253
|
for (let i = 0; i < e.length; i++) {
|
|
254
254
|
const r = e[i], { grp: c } = t.createWrapper(r);
|
|
255
255
|
t.direction === 2 ? r.direction === 0 ? o.appendChild(c) : s.appendChild(c) : t.direction === 0 ? o.appendChild(c) : s.appendChild(c);
|
|
256
256
|
}
|
|
257
257
|
t.nodes.appendChild(o), t.nodes.appendChild(n), t.nodes.appendChild(s), t.nodes.appendChild(t.lines), t.nodes.appendChild(t.labelContainer);
|
|
258
|
-
},
|
|
258
|
+
}, Vt = function(t, e) {
|
|
259
259
|
const n = document.createElement("me-children");
|
|
260
260
|
for (let o = 0; o < e.length; o++) {
|
|
261
261
|
const s = e[o], { grp: i } = t.createWrapper(s);
|
|
262
262
|
n.appendChild(i);
|
|
263
263
|
}
|
|
264
264
|
return n;
|
|
265
|
-
},
|
|
265
|
+
}, Ct = function(t, e) {
|
|
266
266
|
const o = (this?.el ? this.el : e || document).querySelector(`[data-nodeid="me${t}"]`);
|
|
267
267
|
if (!o) throw new Error(`FindEle: Node ${t} not found, maybe it's collapsed.`);
|
|
268
268
|
return o;
|
|
269
|
-
},
|
|
269
|
+
}, Et = function(t, e) {
|
|
270
270
|
if (t.innerHTML = "", e.style) {
|
|
271
271
|
const n = e.style;
|
|
272
272
|
for (const o in n)
|
|
@@ -293,7 +293,7 @@ const G = {
|
|
|
293
293
|
} else t.link && (t.link = void 0);
|
|
294
294
|
if (e.icons && e.icons.length) {
|
|
295
295
|
const n = document.createElement("span");
|
|
296
|
-
n.className = "icons", n.innerHTML = e.icons.map((o) => `<span>${
|
|
296
|
+
n.className = "icons", n.innerHTML = e.icons.map((o) => `<span>${Nt(o)}</span>`).join(""), t.appendChild(n), t.icons = n;
|
|
297
297
|
} else t.icons && (t.icons = void 0);
|
|
298
298
|
if (e.tags && e.tags.length) {
|
|
299
299
|
const n = document.createElement("div");
|
|
@@ -302,35 +302,35 @@ const G = {
|
|
|
302
302
|
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);
|
|
303
303
|
}), t.appendChild(n), t.tags = n;
|
|
304
304
|
} else t.tags && (t.tags = void 0);
|
|
305
|
-
},
|
|
305
|
+
}, Gt = function(t, e) {
|
|
306
306
|
const n = document.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(t);
|
|
307
307
|
if (n.appendChild(o), !e && t.children && t.children.length > 0) {
|
|
308
|
-
const i =
|
|
308
|
+
const i = jt(t.expanded);
|
|
309
309
|
if (o.appendChild(i), t.expanded !== !1) {
|
|
310
|
-
const r =
|
|
310
|
+
const r = Vt(this, t.children);
|
|
311
311
|
n.appendChild(r);
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
return { grp: n, top: o, tpc: s };
|
|
315
|
-
},
|
|
315
|
+
}, zt = function(t) {
|
|
316
316
|
const e = document.createElement("me-parent"), n = this.createTopic(t);
|
|
317
|
-
return
|
|
318
|
-
},
|
|
317
|
+
return Et.call(this, n, t), e.appendChild(n), { p: e, tpc: n };
|
|
318
|
+
}, Ft = function(t) {
|
|
319
319
|
const e = document.createElement("me-children");
|
|
320
320
|
return e.append(...t), e;
|
|
321
|
-
},
|
|
321
|
+
}, qt = function(t) {
|
|
322
322
|
const e = document.createElement("me-tpc");
|
|
323
323
|
return e.nodeObj = t, e.dataset.nodeid = "me" + t.id, e;
|
|
324
324
|
};
|
|
325
|
-
function
|
|
325
|
+
function St(t) {
|
|
326
326
|
const e = document.createRange();
|
|
327
327
|
e.selectNodeContents(t);
|
|
328
328
|
const n = window.getSelection();
|
|
329
329
|
n && (n.removeAllRanges(), n.addRange(e));
|
|
330
330
|
}
|
|
331
|
-
const
|
|
331
|
+
const _t = function(t) {
|
|
332
332
|
if (!t) return;
|
|
333
|
-
const e = document.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } =
|
|
333
|
+
const e = document.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = N(this.nodes, t);
|
|
334
334
|
this.nodes.appendChild(e), e.id = "input-box", e.textContent = o, e.contentEditable = "plaintext-only", e.spellcheck = !1;
|
|
335
335
|
const r = getComputedStyle(t);
|
|
336
336
|
e.style.cssText = `
|
|
@@ -343,16 +343,16 @@ const Ut = function(t) {
|
|
|
343
343
|
margin:${r.margin};
|
|
344
344
|
background-color:${r.backgroundColor !== "rgba(0, 0, 0, 0)" && r.backgroundColor};
|
|
345
345
|
border: ${r.border};
|
|
346
|
-
border-radius:${r.borderRadius}; `, this.direction === 0 && (e.style.right = "0"),
|
|
346
|
+
border-radius:${r.borderRadius}; `, this.direction === 0 && (e.style.right = "0"), St(e), this.bus.fire("operation", {
|
|
347
347
|
name: "beginEdit",
|
|
348
348
|
obj: t.nodeObj
|
|
349
349
|
}), e.addEventListener("keydown", (c) => {
|
|
350
350
|
c.stopPropagation();
|
|
351
|
-
const
|
|
352
|
-
if (
|
|
351
|
+
const a = c.key;
|
|
352
|
+
if (a === "Enter" || a === "Tab") {
|
|
353
353
|
if (c.shiftKey) return;
|
|
354
354
|
c.preventDefault(), e.blur(), this.container.focus();
|
|
355
|
-
} else
|
|
355
|
+
} else a === "Escape" && (c.preventDefault(), e.textContent = o, e.blur(), this.container.focus());
|
|
356
356
|
}), e.addEventListener("blur", () => {
|
|
357
357
|
if (!e) return;
|
|
358
358
|
e.remove();
|
|
@@ -363,14 +363,14 @@ const Ut = function(t) {
|
|
|
363
363
|
origin: o
|
|
364
364
|
}));
|
|
365
365
|
});
|
|
366
|
-
},
|
|
366
|
+
}, jt = function(t) {
|
|
367
367
|
const e = document.createElement("me-epd");
|
|
368
368
|
return e.expanded = t !== !1, e.className = t !== !1 ? "minus" : "", e;
|
|
369
|
-
},
|
|
369
|
+
}, Ut = function(t) {
|
|
370
370
|
const n = t.parentElement.parentElement.lastElementChild;
|
|
371
371
|
n?.tagName === "svg" && n?.remove();
|
|
372
372
|
};
|
|
373
|
-
function
|
|
373
|
+
function Kt(t) {
|
|
374
374
|
return {
|
|
375
375
|
nodeData: t.isFocusMode ? t.nodeDataBackup : t.nodeData,
|
|
376
376
|
arrows: t.arrows,
|
|
@@ -379,51 +379,51 @@ function Zt(t) {
|
|
|
379
379
|
theme: t.theme
|
|
380
380
|
};
|
|
381
381
|
}
|
|
382
|
-
const
|
|
382
|
+
const Jt = function(t) {
|
|
383
383
|
const e = this.container, n = t.getBoundingClientRect(), o = e.getBoundingClientRect();
|
|
384
384
|
if (n.top > o.bottom - 50 || n.bottom < o.top + 50 || n.left > o.right - 50 || n.right < o.left + 50) {
|
|
385
|
-
const i = n.left + n.width / 2, r = n.top + n.height / 2, c = o.left + o.width / 2,
|
|
386
|
-
this.move(-
|
|
385
|
+
const i = n.left + n.width / 2, r = n.top + n.height / 2, c = o.left + o.width / 2, a = o.top + o.height / 2, d = i - c, h = r - a;
|
|
386
|
+
this.move(-d, -h, !0);
|
|
387
387
|
}
|
|
388
|
-
},
|
|
388
|
+
}, Zt = function(t, e, n) {
|
|
389
389
|
this.clearSelection(), this.scrollIntoView(t), this.selection?.select(t), e && this.bus.fire("selectNewNode", t.nodeObj);
|
|
390
|
-
},
|
|
390
|
+
}, Qt = function(t) {
|
|
391
391
|
this.selection?.select(t);
|
|
392
|
-
},
|
|
392
|
+
}, te = function(t) {
|
|
393
393
|
this.selection?.deselect(t);
|
|
394
|
-
},
|
|
394
|
+
}, ee = function() {
|
|
395
395
|
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
396
|
-
},
|
|
396
|
+
}, Tt = function(t) {
|
|
397
397
|
return JSON.stringify(t, (e, n) => {
|
|
398
398
|
if (!(e === "parent" && typeof n != "string"))
|
|
399
399
|
return n;
|
|
400
400
|
});
|
|
401
|
-
},
|
|
402
|
-
const t =
|
|
403
|
-
return
|
|
404
|
-
},
|
|
401
|
+
}, ne = function() {
|
|
402
|
+
const t = Kt(this);
|
|
403
|
+
return Tt(t);
|
|
404
|
+
}, oe = function() {
|
|
405
405
|
return JSON.parse(this.getDataString());
|
|
406
|
-
},
|
|
406
|
+
}, se = function() {
|
|
407
407
|
this.editable = !0;
|
|
408
|
-
},
|
|
408
|
+
}, ie = function() {
|
|
409
409
|
this.editable = !1;
|
|
410
|
-
},
|
|
410
|
+
}, re = function(t, e = { x: 0, y: 0 }) {
|
|
411
411
|
if (t < this.scaleMin && t < this.scaleVal || t > this.scaleMax && t > this.scaleVal) return;
|
|
412
|
-
const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0, s = e.y ? e.y - n.top - n.height / 2 : 0, { dx: i, dy: r } =
|
|
413
|
-
this.map.style.transform = `translate3d(${
|
|
414
|
-
},
|
|
412
|
+
const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0, s = e.y ? e.y - n.top - n.height / 2 : 0, { dx: i, dy: r } = rt(this), c = this.map.style.transform, { x: a, y: d } = it(c), h = a - i, f = d - r, p = this.scaleVal, w = (-o + h) * (1 - t / p), y = (-s + f) * (1 - t / p);
|
|
413
|
+
this.map.style.transform = `translate3d(${a - w}px, ${d - y}px, 0) scale(${t})`, this.scaleVal = t, this.bus.fire("scale", t);
|
|
414
|
+
}, ce = function() {
|
|
415
415
|
const t = this.nodes.offsetHeight / this.container.offsetHeight, e = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(t, e));
|
|
416
416
|
this.scaleVal = n;
|
|
417
|
-
const { dx: o, dy: s } =
|
|
417
|
+
const { dx: o, dy: s } = rt(this, !0);
|
|
418
418
|
this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n);
|
|
419
|
-
},
|
|
419
|
+
}, le = function(t, e, n = !1) {
|
|
420
420
|
const { map: o, scaleVal: s, bus: i, container: r, nodes: c } = this;
|
|
421
421
|
if (n && o.style.transition === "transform 0.3s")
|
|
422
422
|
return;
|
|
423
|
-
const
|
|
424
|
-
let { x:
|
|
425
|
-
const f = r.getBoundingClientRect(), p = c.getBoundingClientRect(),
|
|
426
|
-
if (
|
|
423
|
+
const a = o.style.transform;
|
|
424
|
+
let { x: d, y: h } = it(a);
|
|
425
|
+
const f = r.getBoundingClientRect(), p = c.getBoundingClientRect(), w = p.left < f.right && p.right > f.left, y = p.top < f.bottom && p.bottom > f.top;
|
|
426
|
+
if (w) {
|
|
427
427
|
const u = p.left + t, g = p.right + t;
|
|
428
428
|
(u >= f.right || g <= f.left) && (t = 0);
|
|
429
429
|
}
|
|
@@ -431,42 +431,42 @@ const Qt = function(t) {
|
|
|
431
431
|
const u = p.top + e, g = p.bottom + e;
|
|
432
432
|
(u >= f.bottom || g <= f.top) && (e = 0);
|
|
433
433
|
}
|
|
434
|
-
|
|
434
|
+
d += t, h += e, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
435
435
|
o.style.transition = "none";
|
|
436
|
-
}, 300)), o.style.transform = `translate3d(${
|
|
437
|
-
},
|
|
436
|
+
}, 300)), o.style.transform = `translate3d(${d}px, ${h}px, 0) scale(${s})`, i.fire("move", { dx: t, dy: e });
|
|
437
|
+
}, rt = (t, e = !1) => {
|
|
438
438
|
const { container: n, map: o, nodes: s } = t;
|
|
439
439
|
let i, r;
|
|
440
440
|
if (t.alignment === "nodes" || e)
|
|
441
441
|
i = (n.offsetWidth - s.offsetWidth) / 2, r = (n.offsetHeight - s.offsetHeight) / 2, o.style.transformOrigin = "50% 50%";
|
|
442
442
|
else {
|
|
443
|
-
const c = o.querySelector("me-root"),
|
|
444
|
-
i = n.offsetWidth / 2 -
|
|
443
|
+
const c = o.querySelector("me-root"), a = c.offsetTop, d = c.offsetLeft, h = c.offsetWidth, f = c.offsetHeight;
|
|
444
|
+
i = n.offsetWidth / 2 - d - h / 2, r = n.offsetHeight / 2 - a - f / 2, o.style.transformOrigin = `${d + h / 2}px 50%`;
|
|
445
445
|
}
|
|
446
446
|
return { dx: i, dy: r };
|
|
447
|
-
},
|
|
448
|
-
const { map: t, container: e } = this, { dx: n, dy: o } =
|
|
447
|
+
}, ae = function() {
|
|
448
|
+
const { map: t, container: e } = this, { dx: n, dy: o } = rt(this);
|
|
449
449
|
e.scrollTop = 0, e.scrollLeft = 0, t.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
|
|
450
|
-
},
|
|
450
|
+
}, de = function(t) {
|
|
451
451
|
t(this);
|
|
452
|
-
},
|
|
452
|
+
}, he = function(t) {
|
|
453
453
|
t.nodeObj.parent && (this.clearSelection(), this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = t.nodeObj, this.initRight(), this.toCenter());
|
|
454
|
-
},
|
|
454
|
+
}, fe = function() {
|
|
455
455
|
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
456
|
-
},
|
|
456
|
+
}, ue = function() {
|
|
457
457
|
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
458
|
-
},
|
|
458
|
+
}, pe = function() {
|
|
459
459
|
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
460
|
-
},
|
|
460
|
+
}, ge = function() {
|
|
461
461
|
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
462
|
-
},
|
|
462
|
+
}, me = function(t, e) {
|
|
463
463
|
const n = t.nodeObj;
|
|
464
464
|
typeof e == "boolean" ? n.expanded = e : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
465
465
|
const o = t.getBoundingClientRect(), s = {
|
|
466
466
|
x: o.left,
|
|
467
467
|
y: o.top
|
|
468
468
|
}, i = t.parentNode, r = i.children[1];
|
|
469
|
-
if (r.expanded = n.expanded, r.className = n.expanded ? "minus" : "",
|
|
469
|
+
if (r.expanded = n.expanded, r.className = n.expanded ? "minus" : "", Ut(t), n.expanded) {
|
|
470
470
|
const f = this.createChildren(
|
|
471
471
|
n.children.map((p) => this.createWrapper(p).grp)
|
|
472
472
|
);
|
|
@@ -474,98 +474,115 @@ const Qt = function(t) {
|
|
|
474
474
|
} else
|
|
475
475
|
i.parentNode.children[1].remove();
|
|
476
476
|
this.linkDiv(t.closest("me-main > me-wrapper"));
|
|
477
|
-
const c = t.getBoundingClientRect(),
|
|
477
|
+
const c = t.getBoundingClientRect(), a = {
|
|
478
478
|
x: c.left,
|
|
479
479
|
y: c.top
|
|
480
|
-
},
|
|
481
|
-
this.move(
|
|
482
|
-
},
|
|
480
|
+
}, d = s.x - a.x, h = s.y - a.y;
|
|
481
|
+
this.move(d, h), this.bus.fire("expandNode", n);
|
|
482
|
+
}, ye = function(t, e) {
|
|
483
483
|
const n = t.nodeObj, o = t.getBoundingClientRect(), s = {
|
|
484
484
|
x: o.left,
|
|
485
485
|
y: o.top
|
|
486
486
|
};
|
|
487
|
-
|
|
487
|
+
wt(n, e ?? !n.expanded), this.refresh();
|
|
488
488
|
const i = this.findEle(n.id).getBoundingClientRect(), r = {
|
|
489
489
|
x: i.left,
|
|
490
490
|
y: i.top
|
|
491
|
-
}, c = s.x - r.x,
|
|
492
|
-
this.move(c,
|
|
493
|
-
},
|
|
494
|
-
this.clearSelection(), t && (t = JSON.parse(JSON.stringify(t)), this.nodeData = t.nodeData, this.arrows = t.arrows || [], this.summaries = t.summaries || [], t.theme && this.changeTheme(t.theme)),
|
|
495
|
-
},
|
|
491
|
+
}, c = s.x - r.x, a = s.y - r.y;
|
|
492
|
+
this.move(c, a);
|
|
493
|
+
}, we = function(t) {
|
|
494
|
+
this.clearSelection(), t && (t = JSON.parse(JSON.stringify(t)), this.nodeData = t.nodeData, this.arrows = t.arrows || [], this.summaries = t.summaries || [], t.theme && this.changeTheme(t.theme)), st(this.nodeData), this.layout(), this.linkDiv();
|
|
495
|
+
}, ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
496
496
|
__proto__: null,
|
|
497
|
-
cancelFocus:
|
|
498
|
-
clearSelection:
|
|
499
|
-
disableEdit:
|
|
500
|
-
enableEdit:
|
|
501
|
-
expandNode:
|
|
502
|
-
expandNodeAll:
|
|
503
|
-
focusNode:
|
|
504
|
-
getData:
|
|
505
|
-
getDataString:
|
|
506
|
-
initLeft:
|
|
507
|
-
initRight:
|
|
508
|
-
initSide:
|
|
509
|
-
install:
|
|
510
|
-
move:
|
|
511
|
-
refresh:
|
|
512
|
-
scale:
|
|
513
|
-
scaleFit:
|
|
514
|
-
scrollIntoView:
|
|
515
|
-
selectNode:
|
|
516
|
-
selectNodes:
|
|
517
|
-
stringifyData:
|
|
518
|
-
toCenter:
|
|
519
|
-
unselectNodes:
|
|
520
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
521
|
-
const i = -
|
|
497
|
+
cancelFocus: fe,
|
|
498
|
+
clearSelection: ee,
|
|
499
|
+
disableEdit: ie,
|
|
500
|
+
enableEdit: se,
|
|
501
|
+
expandNode: me,
|
|
502
|
+
expandNodeAll: ye,
|
|
503
|
+
focusNode: he,
|
|
504
|
+
getData: oe,
|
|
505
|
+
getDataString: ne,
|
|
506
|
+
initLeft: ue,
|
|
507
|
+
initRight: pe,
|
|
508
|
+
initSide: ge,
|
|
509
|
+
install: de,
|
|
510
|
+
move: le,
|
|
511
|
+
refresh: we,
|
|
512
|
+
scale: re,
|
|
513
|
+
scaleFit: ce,
|
|
514
|
+
scrollIntoView: Jt,
|
|
515
|
+
selectNode: Zt,
|
|
516
|
+
selectNodes: Qt,
|
|
517
|
+
stringifyData: Tt,
|
|
518
|
+
toCenter: ae,
|
|
519
|
+
unselectNodes: te
|
|
520
|
+
}, Symbol.toStringTag, { value: "Module" })), be = 40, xe = 10, Ce = ({ deltaMode: t, deltaY: e, viewportHeight: n }) => t === WheelEvent.DOM_DELTA_LINE ? e * be : t === WheelEvent.DOM_DELTA_PAGE ? e * n : e, Ee = ({ deltaMode: t, deltaY: e, scaleSensitivity: n, viewportHeight: o }) => {
|
|
521
|
+
const i = -Ce({ deltaMode: t, deltaY: e, viewportHeight: o }) / xe * n;
|
|
522
522
|
return Math.max(-n, Math.min(n, i));
|
|
523
|
-
},
|
|
523
|
+
}, Se = (t, e, n) => {
|
|
524
524
|
e !== 0 && t.scale(t.scaleVal + e, n);
|
|
525
|
-
},
|
|
526
|
-
const n =
|
|
525
|
+
}, Te = (t, e) => {
|
|
526
|
+
const n = Ee({
|
|
527
527
|
deltaMode: e.deltaMode,
|
|
528
528
|
deltaY: e.deltaY,
|
|
529
529
|
scaleSensitivity: t.scaleSensitivity,
|
|
530
530
|
viewportHeight: t.container.clientHeight || window.innerHeight
|
|
531
531
|
});
|
|
532
|
-
|
|
532
|
+
Se(t, n, { x: e.clientX, y: e.clientY });
|
|
533
533
|
};
|
|
534
|
-
function
|
|
535
|
-
const { panHelper: e } = t;
|
|
536
|
-
let
|
|
534
|
+
function Le(t) {
|
|
535
|
+
const { panHelper: e, container: n } = t;
|
|
536
|
+
let o = 0, s = null;
|
|
537
537
|
t.spacePressed = !1;
|
|
538
|
-
let
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
538
|
+
let i = null;
|
|
539
|
+
const r = /* @__PURE__ */ new Map(), c = Ot(t), a = {
|
|
540
|
+
timer: null,
|
|
541
|
+
startPos: null,
|
|
542
|
+
target: null,
|
|
543
|
+
pointerId: null,
|
|
544
|
+
DURATION: 500,
|
|
545
|
+
MOVE_THRESHOLD: 10,
|
|
546
|
+
clear() {
|
|
547
|
+
this.timer !== null && (clearTimeout(this.timer), this.timer = null, this.startPos = null, this.target = null, this.pointerId = null);
|
|
548
|
+
},
|
|
549
|
+
start(l, m) {
|
|
550
|
+
this.timer = window.setTimeout(() => {
|
|
551
|
+
m(l), this.timer = null, this.startPos = null, this.target = null, this.pointerId = null;
|
|
552
|
+
}, this.DURATION), this.startPos = { x: l.clientX, y: l.clientY }, this.target = l.target, this.pointerId = l.pointerId;
|
|
553
|
+
},
|
|
554
|
+
handleMove(l) {
|
|
555
|
+
if (this.timer !== null && this.startPos !== null && l.pointerId === this.pointerId) {
|
|
556
|
+
const m = l.clientX - this.startPos.x, x = l.clientY - this.startPos.y;
|
|
557
|
+
Math.sqrt(m * m + x * x) > this.MOVE_THRESHOLD && this.clear();
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}, d = (l, m) => {
|
|
561
|
+
l.hasPointerCapture && l.hasPointerCapture(m) && l.releasePointerCapture(m);
|
|
562
|
+
}, h = (l, m) => {
|
|
546
563
|
if (l.id === "input-box" || l.closest("#input-box")) return !1;
|
|
547
|
-
const
|
|
548
|
-
if (
|
|
549
|
-
const
|
|
550
|
-
if (
|
|
551
|
-
if (
|
|
552
|
-
return
|
|
553
|
-
if (
|
|
554
|
-
return
|
|
564
|
+
const x = l.closest(".svg-label");
|
|
565
|
+
if (x) {
|
|
566
|
+
const E = x.dataset.svgId, A = x.dataset.type, H = document.getElementById(E);
|
|
567
|
+
if (H) {
|
|
568
|
+
if (A === "arrow")
|
|
569
|
+
return m ? t.editArrowLabel(H) : t.selectArrow(H), !0;
|
|
570
|
+
if (A === "summary")
|
|
571
|
+
return m ? t.editSummary(H) : t.selectSummary(H), !0;
|
|
555
572
|
}
|
|
556
573
|
}
|
|
557
574
|
if (l.closest(".topiclinks")) {
|
|
558
|
-
const
|
|
559
|
-
if (
|
|
560
|
-
return
|
|
575
|
+
const E = l.closest("g");
|
|
576
|
+
if (E)
|
|
577
|
+
return m ? t.editArrowLabel(E) : t.selectArrow(E), !0;
|
|
561
578
|
}
|
|
562
579
|
if (l.closest(".summary")) {
|
|
563
|
-
const
|
|
564
|
-
if (
|
|
565
|
-
return
|
|
580
|
+
const E = l.closest("g");
|
|
581
|
+
if (E)
|
|
582
|
+
return m ? t.editSummary(E) : t.selectSummary(E), !0;
|
|
566
583
|
}
|
|
567
584
|
return !1;
|
|
568
|
-
},
|
|
585
|
+
}, f = (l) => {
|
|
569
586
|
if (l.pointerType === "mouse" && l.button !== 0) return;
|
|
570
587
|
if (t.helper1?.moved) {
|
|
571
588
|
t.helper1.clear();
|
|
@@ -579,125 +596,119 @@ function Me(t) {
|
|
|
579
596
|
e.clear();
|
|
580
597
|
return;
|
|
581
598
|
}
|
|
582
|
-
if (
|
|
599
|
+
if (c?.isDragging)
|
|
583
600
|
return;
|
|
584
|
-
const
|
|
585
|
-
if (
|
|
586
|
-
l.ctrlKey || l.metaKey ? t.expandNodeAll(
|
|
601
|
+
const m = l.target;
|
|
602
|
+
if (m.tagName === "ME-EPD")
|
|
603
|
+
l.ctrlKey || l.metaKey ? t.expandNodeAll(m.previousSibling) : t.expandNode(m.previousSibling);
|
|
587
604
|
else if (!t.editable)
|
|
588
605
|
return;
|
|
589
|
-
|
|
590
|
-
},
|
|
606
|
+
h(m, !1);
|
|
607
|
+
}, p = (l) => {
|
|
591
608
|
if (!t.editable) return;
|
|
592
|
-
const
|
|
593
|
-
|
|
594
|
-
},
|
|
595
|
-
l.
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
}, S = (l) => {
|
|
599
|
-
if (l.pointerType === "touch" && (i.set(l.pointerId, { x: l.clientX, y: l.clientY }), i.size === 2)) {
|
|
600
|
-
const [D, V] = Array.from(i.values());
|
|
601
|
-
s = ut(D, V), m();
|
|
609
|
+
const m = l.target;
|
|
610
|
+
G(m) && t.beginEdit(m), h(m, !0);
|
|
611
|
+
}, w = (l) => {
|
|
612
|
+
if (l.pointerType === "touch" && (r.set(l.pointerId, { x: l.clientX, y: l.clientY }), r.size === 2)) {
|
|
613
|
+
const [E, A] = Array.from(r.values());
|
|
614
|
+
i = ht(E, A), a.clear();
|
|
602
615
|
}
|
|
603
616
|
e.moved = !1;
|
|
604
|
-
const
|
|
605
|
-
if (t.editable && (l.button === 0 || l.pointerType === "touch") &&
|
|
617
|
+
const m = l.target, x = t.mouseSelectionButton === 0 ? 2 : 0;
|
|
618
|
+
if (t.editable && (l.button === 0 || l.pointerType === "touch") && G(m)) {
|
|
606
619
|
t.selection?.cancel();
|
|
607
|
-
const
|
|
620
|
+
const E = t.currentNodes || [];
|
|
608
621
|
if (l.ctrlKey || l.metaKey)
|
|
609
|
-
if (
|
|
610
|
-
t.selection?.deselect(
|
|
622
|
+
if (E.includes(m)) {
|
|
623
|
+
t.selection?.deselect(m);
|
|
611
624
|
return;
|
|
612
625
|
} else
|
|
613
|
-
t.selection?.select(
|
|
614
|
-
else
|
|
626
|
+
t.selection?.select(m);
|
|
627
|
+
else E.includes(m) || t.selectNode(m);
|
|
615
628
|
}
|
|
616
629
|
if (t.editable && (l.button === 0 || l.pointerType === "touch")) {
|
|
617
|
-
if (l.pointerType === "touch" &&
|
|
618
|
-
(
|
|
619
|
-
else if (l.pointerType === "touch" &&
|
|
620
|
-
(
|
|
621
|
-
|
|
622
|
-
}
|
|
623
|
-
else if (l.pointerType === "mouse" &&
|
|
624
|
-
|
|
630
|
+
if (l.pointerType === "touch" && r.size > 1)
|
|
631
|
+
(c.isDragging || c.pointerId !== null) && Q(t, c);
|
|
632
|
+
else if (l.pointerType === "touch" && r.size === 1)
|
|
633
|
+
(G(m) || m.closest("me-tpc")) && a.start(l, (E) => {
|
|
634
|
+
ut(t, c, E, !0) && (a.target && a.target.setPointerCapture(E.pointerId), bt(c.ghost, E.clientX, E.clientY));
|
|
635
|
+
});
|
|
636
|
+
else if (l.pointerType === "mouse" && ut(t, c, l, !1)) {
|
|
637
|
+
m.setPointerCapture(l.pointerId);
|
|
625
638
|
return;
|
|
626
639
|
}
|
|
627
640
|
}
|
|
628
|
-
const
|
|
629
|
-
!
|
|
630
|
-
},
|
|
631
|
-
if (l.pointerType === "touch" &&
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
const B = N / s;
|
|
643
|
-
t.scale(t.scaleVal * B, {
|
|
644
|
-
x: (w.x + E.x) / 2,
|
|
645
|
-
y: (w.y + E.y) / 2
|
|
646
|
-
});
|
|
647
|
-
}
|
|
648
|
-
s = N;
|
|
641
|
+
const L = t.spacePressed && l.button === 0 && l.pointerType === "mouse", I = !t.editable || l.button === x && l.pointerType === "mouse" || l.pointerType === "touch";
|
|
642
|
+
!L && !I || (e.x = l.clientX, e.y = l.clientY, m.className !== "circle" && m.contentEditable !== "plaintext-only" && (e.mousedown = !0, m.setPointerCapture(l.pointerId)));
|
|
643
|
+
}, y = (l) => {
|
|
644
|
+
if (l.pointerType === "touch" && r.has(l.pointerId) && (r.set(l.pointerId, { x: l.clientX, y: l.clientY }), a.handleMove(l), r.size >= 2)) {
|
|
645
|
+
const [m, x] = Array.from(r.values()), L = ht(m, x);
|
|
646
|
+
if (i == null)
|
|
647
|
+
i = L;
|
|
648
|
+
else {
|
|
649
|
+
if (i > 0) {
|
|
650
|
+
const I = L / i;
|
|
651
|
+
t.scale(t.scaleVal * I, {
|
|
652
|
+
x: (m.x + x.x) / 2,
|
|
653
|
+
y: (m.y + x.y) / 2
|
|
654
|
+
});
|
|
649
655
|
}
|
|
650
|
-
|
|
656
|
+
i = L;
|
|
651
657
|
}
|
|
658
|
+
return;
|
|
652
659
|
}
|
|
653
|
-
if (!(
|
|
660
|
+
if (!(c && c.pointerId !== null && (Bt(t, c, l), c.isDragging))) {
|
|
654
661
|
if (l.target.contentEditable !== "plaintext-only" || t.spacePressed && e.mousedown) {
|
|
655
|
-
const
|
|
656
|
-
e.onMove(
|
|
662
|
+
const m = l.clientX - e.x, x = l.clientY - e.y;
|
|
663
|
+
e.onMove(m, x);
|
|
657
664
|
}
|
|
658
665
|
e.x = l.clientX, e.y = l.clientY;
|
|
659
666
|
}
|
|
660
|
-
},
|
|
661
|
-
if (l.pointerType === "touch" && (
|
|
662
|
-
const
|
|
663
|
-
if (
|
|
667
|
+
}, u = (l) => {
|
|
668
|
+
if (l.pointerType === "touch" && (r.delete(l.pointerId), r.size < 2 && (i = null), a.clear()), c && c.pointerId !== null) {
|
|
669
|
+
const x = c.isDragging;
|
|
670
|
+
if (Wt(t, c, l), d(l.target, l.pointerId), x)
|
|
664
671
|
return;
|
|
665
672
|
}
|
|
666
|
-
if (l.pointerType === "touch" &&
|
|
667
|
-
const
|
|
668
|
-
|
|
673
|
+
if (l.pointerType === "touch" && r.size === 0 && !e.moved) {
|
|
674
|
+
const x = (/* @__PURE__ */ new Date()).getTime(), L = x - o;
|
|
675
|
+
L < 300 && L > 0 && s === l.target && p(l), o = x, s = l.target;
|
|
669
676
|
}
|
|
670
|
-
e.mousedown && (
|
|
671
|
-
},
|
|
672
|
-
|
|
673
|
-
},
|
|
674
|
-
l.pointerType === "touch" && (
|
|
675
|
-
},
|
|
677
|
+
e.mousedown && (d(l.target, l.pointerId), e.clear());
|
|
678
|
+
}, g = () => {
|
|
679
|
+
a.clear(), e.mousedown && e.clear(), (c.isDragging || c.pointerId !== null) && Q(t, c);
|
|
680
|
+
}, b = (l) => {
|
|
681
|
+
l.pointerType === "touch" && (r.delete(l.pointerId), r.size < 2 && (i = null), a.clear()), c.pointerId === l.pointerId && Q(t, c), u(l);
|
|
682
|
+
}, v = (l) => {
|
|
676
683
|
if (l.preventDefault(), l.button !== 2 || !t.editable) return;
|
|
677
|
-
const
|
|
678
|
-
|
|
684
|
+
const m = l.target;
|
|
685
|
+
G(m) && !m.classList.contains("selected") && t.selectNode(m), setTimeout(() => {
|
|
679
686
|
t.panHelper.moved || t.bus.fire("showContextMenu", l);
|
|
680
687
|
}, 200);
|
|
681
|
-
},
|
|
682
|
-
if (l.stopPropagation(), l.preventDefault(), l.ctrlKey || l.metaKey) return
|
|
688
|
+
}, C = (l) => {
|
|
689
|
+
if (l.stopPropagation(), l.preventDefault(), l.ctrlKey || l.metaKey) return Te(t, l);
|
|
683
690
|
if (l.shiftKey) return t.move(-l.deltaY, 0);
|
|
684
691
|
t.move(-l.deltaX, -l.deltaY);
|
|
685
|
-
},
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
{ dom:
|
|
692
|
-
{ dom:
|
|
693
|
-
{ dom:
|
|
694
|
-
{ dom:
|
|
695
|
-
{ dom:
|
|
696
|
-
{ dom:
|
|
697
|
-
{ dom:
|
|
692
|
+
}, S = (l) => {
|
|
693
|
+
l.code === "Space" && (t.spacePressed = !0, t.container.classList.add("space-pressed"));
|
|
694
|
+
}, T = (l) => {
|
|
695
|
+
l.code === "Space" && (t.spacePressed = !1, t.container.classList.remove("space-pressed"));
|
|
696
|
+
};
|
|
697
|
+
return vt([
|
|
698
|
+
{ dom: n, evt: "pointerdown", func: w },
|
|
699
|
+
{ dom: n, evt: "pointermove", func: y },
|
|
700
|
+
{ dom: n, evt: "pointerup", func: u },
|
|
701
|
+
{ dom: n, evt: "pointercancel", func: b },
|
|
702
|
+
{ dom: n, evt: "click", func: f },
|
|
703
|
+
{ dom: n, evt: "dblclick", func: p },
|
|
704
|
+
{ dom: n, evt: "contextmenu", func: v },
|
|
705
|
+
{ dom: n, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel : C },
|
|
706
|
+
{ dom: n, evt: "blur", func: g },
|
|
707
|
+
{ dom: n, evt: "keydown", func: S },
|
|
708
|
+
{ dom: n, evt: "keyup", func: T }
|
|
698
709
|
]);
|
|
699
710
|
}
|
|
700
|
-
function
|
|
711
|
+
function De() {
|
|
701
712
|
return {
|
|
702
713
|
handlers: {},
|
|
703
714
|
addListener: function(t, e) {
|
|
@@ -721,31 +732,31 @@ function ke() {
|
|
|
721
732
|
}
|
|
722
733
|
};
|
|
723
734
|
}
|
|
724
|
-
const
|
|
735
|
+
const P = "http://www.w3.org/2000/svg", J = function(t) {
|
|
725
736
|
const e = t.clientWidth, n = t.clientHeight, o = t.dataset, s = Number(o.x), i = Number(o.y), r = o.anchor;
|
|
726
737
|
let c = s;
|
|
727
738
|
r === "middle" ? c = s - e / 2 : r === "end" && (c = s - e), t.style.left = `${c}px`, t.style.top = `${i - n / 2}px`, t.style.visibility = "visible";
|
|
728
|
-
},
|
|
729
|
-
const { anchor: s = "middle", color: i, dataType: r, svgId: c } = o,
|
|
730
|
-
|
|
731
|
-
const
|
|
732
|
-
return
|
|
733
|
-
},
|
|
734
|
-
const o = document.createElementNS(
|
|
739
|
+
}, et = function(t, e, n, o) {
|
|
740
|
+
const { anchor: s = "middle", color: i, dataType: r, svgId: c } = o, a = document.createElement("div");
|
|
741
|
+
a.className = "svg-label", a.style.color = i || "#666";
|
|
742
|
+
const d = "label-" + c;
|
|
743
|
+
return a.id = d, a.innerHTML = t, a.dataset.type = r, a.dataset.svgId = c, a.dataset.x = e.toString(), a.dataset.y = n.toString(), a.dataset.anchor = s, a;
|
|
744
|
+
}, Lt = function(t, e, n) {
|
|
745
|
+
const o = document.createElementNS(P, "path");
|
|
735
746
|
return M(o, {
|
|
736
747
|
d: t,
|
|
737
748
|
stroke: e || "#666",
|
|
738
749
|
fill: "none",
|
|
739
750
|
"stroke-width": n
|
|
740
751
|
}), o;
|
|
741
|
-
},
|
|
742
|
-
const e = document.createElementNS(
|
|
752
|
+
}, W = function(t) {
|
|
753
|
+
const e = document.createElementNS(P, "svg");
|
|
743
754
|
return e.setAttribute("class", t), e.setAttribute("overflow", "visible"), e;
|
|
744
|
-
},
|
|
745
|
-
const t = document.createElementNS(
|
|
755
|
+
}, pt = function() {
|
|
756
|
+
const t = document.createElementNS(P, "line");
|
|
746
757
|
return t.setAttribute("stroke", "#4dc4ff"), t.setAttribute("fill", "none"), t.setAttribute("stroke-width", "2"), t.setAttribute("opacity", "0.45"), t;
|
|
747
|
-
},
|
|
748
|
-
const s = document.createElementNS(
|
|
758
|
+
}, Me = function(t, e, n, o) {
|
|
759
|
+
const s = document.createElementNS(P, "g");
|
|
749
760
|
return [
|
|
750
761
|
{
|
|
751
762
|
name: "line",
|
|
@@ -760,30 +771,30 @@ const I = "http://www.w3.org/2000/svg", et = function(t) {
|
|
|
760
771
|
d: n
|
|
761
772
|
}
|
|
762
773
|
].forEach((r, c) => {
|
|
763
|
-
const
|
|
764
|
-
d,
|
|
774
|
+
const a = r.d, d = document.createElementNS(P, "path"), h = {
|
|
775
|
+
d: a,
|
|
765
776
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
766
777
|
fill: "none",
|
|
767
778
|
"stroke-linecap": o?.strokeLinecap || "cap",
|
|
768
779
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
769
780
|
};
|
|
770
|
-
o?.opacity !== void 0 && (h.opacity = String(o.opacity)), M(
|
|
771
|
-
const f = document.createElementNS(
|
|
781
|
+
o?.opacity !== void 0 && (h.opacity = String(o.opacity)), M(d, h), c === 0 && d.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
782
|
+
const f = document.createElementNS(P, "path");
|
|
772
783
|
M(f, {
|
|
773
|
-
d,
|
|
784
|
+
d: a,
|
|
774
785
|
stroke: "transparent",
|
|
775
786
|
fill: "none",
|
|
776
787
|
"stroke-width": "15"
|
|
777
|
-
}), s.appendChild(f), s.appendChild(
|
|
788
|
+
}), s.appendChild(f), s.appendChild(d), s[r.name] = d;
|
|
778
789
|
}), s;
|
|
779
|
-
},
|
|
790
|
+
}, Dt = function(t, e, n) {
|
|
780
791
|
if (!e) return;
|
|
781
792
|
const o = n.label, s = e.cloneNode(!0);
|
|
782
793
|
t.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
|
|
783
794
|
left:${e.style.left};
|
|
784
795
|
top:${e.style.top};
|
|
785
796
|
max-width: 200px;
|
|
786
|
-
`,
|
|
797
|
+
`, St(s), t.scrollIntoView(s), s.addEventListener("keydown", (i) => {
|
|
787
798
|
i.stopPropagation();
|
|
788
799
|
const r = i.key;
|
|
789
800
|
if (r === "Enter" || r === "Tab") {
|
|
@@ -793,7 +804,7 @@ const I = "http://www.w3.org/2000/svg", et = function(t) {
|
|
|
793
804
|
}), s.addEventListener("blur", () => {
|
|
794
805
|
if (!s) return;
|
|
795
806
|
const i = s.innerText?.trim() || "";
|
|
796
|
-
i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (t.markdown ? e.innerHTML = t.markdown(n.label, n) : e.textContent = n.label,
|
|
807
|
+
i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (t.markdown ? e.innerHTML = t.markdown(n.label, n) : e.textContent = n.label, J(e), "parent" in n ? t.bus.fire("operation", {
|
|
797
808
|
name: "finishEditSummary",
|
|
798
809
|
obj: n
|
|
799
810
|
}) : t.bus.fire("operation", {
|
|
@@ -801,62 +812,62 @@ const I = "http://www.w3.org/2000/svg", et = function(t) {
|
|
|
801
812
|
obj: n
|
|
802
813
|
}));
|
|
803
814
|
});
|
|
804
|
-
},
|
|
815
|
+
}, ke = function(t) {
|
|
805
816
|
const e = this.map.querySelector("me-root"), n = e.offsetTop, o = e.offsetLeft, s = e.offsetWidth, i = e.offsetHeight, r = this.map.querySelectorAll("me-main > me-wrapper");
|
|
806
817
|
this.lines.innerHTML = "";
|
|
807
818
|
for (let c = 0; c < r.length; c++) {
|
|
808
|
-
const
|
|
809
|
-
if (
|
|
819
|
+
const a = r[c], d = a.querySelector("me-tpc"), { offsetLeft: h, offsetTop: f } = N(this.nodes, d), p = d.offsetWidth, w = d.offsetHeight, y = a.parentNode.className, u = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: f, cL: h, cW: p, cH: w, direction: y, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, b = d.nodeObj.branchColor || g[c % g.length];
|
|
820
|
+
if (d.style.borderColor = b, this.lines.appendChild(Lt(u, b, "3")), t && t !== a)
|
|
810
821
|
continue;
|
|
811
|
-
const v =
|
|
812
|
-
|
|
822
|
+
const v = W("subLines"), C = a.lastChild;
|
|
823
|
+
C.tagName === "svg" && C.remove(), a.appendChild(v), Mt(this, v, b, a, y, !0);
|
|
813
824
|
}
|
|
814
825
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
815
|
-
},
|
|
826
|
+
}, Mt = function(t, e, n, o, s, i) {
|
|
816
827
|
const r = o.firstChild, c = o.children[1].children;
|
|
817
828
|
if (c.length === 0) return;
|
|
818
|
-
const
|
|
829
|
+
const a = r.offsetTop, d = r.offsetLeft, h = r.offsetWidth, f = r.offsetHeight;
|
|
819
830
|
for (let p = 0; p < c.length; p++) {
|
|
820
|
-
const
|
|
821
|
-
e.appendChild(
|
|
831
|
+
const w = c[p], y = w.firstChild, u = y.offsetTop, g = y.offsetLeft, b = y.offsetWidth, v = y.offsetHeight, C = y.firstChild.nodeObj.branchColor || n, S = t.generateSubBranch({ pT: a, pL: d, pW: h, pH: f, cT: u, cL: g, cW: b, cH: v, direction: s, isFirst: i });
|
|
832
|
+
e.appendChild(Lt(S, C, "2"));
|
|
822
833
|
const T = y.children[1];
|
|
823
834
|
if (T) {
|
|
824
835
|
if (!T.expanded) continue;
|
|
825
836
|
} else
|
|
826
837
|
continue;
|
|
827
|
-
|
|
838
|
+
Mt(t, e, C, w, s);
|
|
828
839
|
}
|
|
829
|
-
}, Ae = '<?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>',
|
|
840
|
+
}, Ae = '<?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>', Ne = '<?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>', Pe = '<?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>', $e = '<?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>', He = '<?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>', Ie = '<?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>', Oe = '<?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>', Ye = {
|
|
830
841
|
side: Ae,
|
|
831
|
-
left:
|
|
832
|
-
right:
|
|
833
|
-
full:
|
|
834
|
-
living:
|
|
835
|
-
zoomin:
|
|
836
|
-
zoomout:
|
|
837
|
-
},
|
|
842
|
+
left: Ne,
|
|
843
|
+
right: Pe,
|
|
844
|
+
full: $e,
|
|
845
|
+
living: He,
|
|
846
|
+
zoomin: Ie,
|
|
847
|
+
zoomout: Oe
|
|
848
|
+
}, O = (t, e) => {
|
|
838
849
|
const n = document.createElement("span");
|
|
839
|
-
return n.id = t, n.innerHTML =
|
|
850
|
+
return n.id = t, n.innerHTML = Ye[e], n;
|
|
840
851
|
};
|
|
841
|
-
function
|
|
842
|
-
const e = document.createElement("div"), n =
|
|
852
|
+
function Be(t) {
|
|
853
|
+
const e = document.createElement("div"), n = O("fullscreen", "full"), o = O("toCenter", "living"), s = O("zoomout", "zoomout"), i = O("zoomin", "zoomin");
|
|
843
854
|
e.appendChild(n), e.appendChild(o), e.appendChild(s), e.appendChild(i), e.className = "mind-elixir-toolbar rb";
|
|
844
855
|
let r = null;
|
|
845
856
|
const c = () => {
|
|
846
|
-
const
|
|
857
|
+
const d = t.container.getBoundingClientRect(), h = it(t.map.style.transform), f = d.width / 2, p = d.height / 2, w = (f - h.x) / t.scaleVal, y = (p - h.y) / t.scaleVal;
|
|
847
858
|
r = {
|
|
848
|
-
containerRect:
|
|
859
|
+
containerRect: d,
|
|
849
860
|
currentTransform: h,
|
|
850
|
-
mapCenterX:
|
|
861
|
+
mapCenterX: w,
|
|
851
862
|
mapCenterY: y
|
|
852
863
|
};
|
|
853
|
-
},
|
|
864
|
+
}, a = () => {
|
|
854
865
|
if (r) {
|
|
855
|
-
const
|
|
866
|
+
const d = t.container.getBoundingClientRect(), h = d.width / 2, f = d.height / 2, p = h - r.mapCenterX * t.scaleVal, w = f - r.mapCenterY * t.scaleVal, y = p - r.currentTransform.x, u = w - r.currentTransform.y;
|
|
856
867
|
t.move(y, u);
|
|
857
868
|
}
|
|
858
869
|
};
|
|
859
|
-
return t.el.addEventListener("fullscreenchange",
|
|
870
|
+
return t.el.addEventListener("fullscreenchange", a), n.onclick = () => {
|
|
860
871
|
c(), document.fullscreenElement !== t.el ? t.el.requestFullscreen() : document.exitFullscreen();
|
|
861
872
|
}, o.onclick = () => {
|
|
862
873
|
t.toCenter();
|
|
@@ -866,8 +877,8 @@ function Re(t) {
|
|
|
866
877
|
t.scale(t.scaleVal + t.scaleSensitivity);
|
|
867
878
|
}, e;
|
|
868
879
|
}
|
|
869
|
-
function
|
|
870
|
-
const e = document.createElement("div"), n =
|
|
880
|
+
function We(t) {
|
|
881
|
+
const e = document.createElement("div"), n = O("tbltl", "left"), o = O("tbltr", "right"), s = O("tblts", "side");
|
|
871
882
|
return e.appendChild(n), e.appendChild(o), e.appendChild(s), e.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
872
883
|
t.initLeft();
|
|
873
884
|
}, o.onclick = () => {
|
|
@@ -876,13 +887,13 @@ function Xe(t) {
|
|
|
876
887
|
t.initSide();
|
|
877
888
|
}, e;
|
|
878
889
|
}
|
|
879
|
-
function
|
|
880
|
-
t.container.append(
|
|
890
|
+
function Re(t) {
|
|
891
|
+
t.container.append(Be(t)), t.container.append(We(t));
|
|
881
892
|
}
|
|
882
|
-
const
|
|
893
|
+
const Xe = function(t, e = !0) {
|
|
883
894
|
this.theme = t;
|
|
884
895
|
const o = {
|
|
885
|
-
...(t.type === "dark" ?
|
|
896
|
+
...(t.type === "dark" ? ot : nt).cssVar,
|
|
886
897
|
...t.cssVar
|
|
887
898
|
}, s = Object.keys(o);
|
|
888
899
|
for (let i = 0; i < s.length; i++) {
|
|
@@ -890,7 +901,7 @@ const Ve = function(t, e = !0) {
|
|
|
890
901
|
this.container.style.setProperty(r, o[r]);
|
|
891
902
|
}
|
|
892
903
|
e && this.refresh();
|
|
893
|
-
},
|
|
904
|
+
}, Ve = function(t) {
|
|
894
905
|
return {
|
|
895
906
|
dom: t,
|
|
896
907
|
moved: !1,
|
|
@@ -913,7 +924,7 @@ const Ve = function(t, e = !0) {
|
|
|
913
924
|
},
|
|
914
925
|
cb: null,
|
|
915
926
|
init(e, n) {
|
|
916
|
-
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy =
|
|
927
|
+
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = vt([
|
|
917
928
|
{ dom: e, evt: "pointermove", func: this.handlePointerMove },
|
|
918
929
|
{ dom: e, evt: "pointerleave", func: this.handleClear },
|
|
919
930
|
{ dom: e, evt: "pointerup", func: this.handleClear },
|
|
@@ -925,19 +936,19 @@ const Ve = function(t, e = !0) {
|
|
|
925
936
|
this.moved = !1, this.pointerdown = !1;
|
|
926
937
|
}
|
|
927
938
|
};
|
|
928
|
-
},
|
|
929
|
-
create:
|
|
930
|
-
},
|
|
931
|
-
function
|
|
939
|
+
}, gt = {
|
|
940
|
+
create: Ve
|
|
941
|
+
}, Ge = "#4dc4ff";
|
|
942
|
+
function kt(t, e, n, o, s, i, r, c) {
|
|
932
943
|
return {
|
|
933
944
|
x: t / 8 + n * 3 / 8 + s * 3 / 8 + r / 8,
|
|
934
945
|
y: e / 8 + o * 3 / 8 + i * 3 / 8 + c / 8
|
|
935
946
|
};
|
|
936
947
|
}
|
|
937
|
-
function
|
|
938
|
-
t && (t.dataset.x = e.toString(), t.dataset.y = n.toString(),
|
|
948
|
+
function ze(t, e, n) {
|
|
949
|
+
t && (t.dataset.x = e.toString(), t.dataset.y = n.toString(), J(t));
|
|
939
950
|
}
|
|
940
|
-
function
|
|
951
|
+
function z(t, e, n, o, s) {
|
|
941
952
|
M(t, {
|
|
942
953
|
x1: e + "",
|
|
943
954
|
y1: n + "",
|
|
@@ -945,51 +956,51 @@ function j(t, e, n, o, s) {
|
|
|
945
956
|
y2: s + ""
|
|
946
957
|
});
|
|
947
958
|
}
|
|
948
|
-
function
|
|
949
|
-
const h = `M ${e} ${n} C ${o} ${s} ${i} ${r} ${c} ${
|
|
950
|
-
if (t.line.setAttribute("d", h),
|
|
951
|
-
const u =
|
|
959
|
+
function mt(t, e, n, o, s, i, r, c, a, d) {
|
|
960
|
+
const h = `M ${e} ${n} C ${o} ${s} ${i} ${r} ${c} ${a}`;
|
|
961
|
+
if (t.line.setAttribute("d", h), d.style) {
|
|
962
|
+
const u = d.style;
|
|
952
963
|
u.stroke && t.line.setAttribute("stroke", u.stroke), u.strokeWidth && t.line.setAttribute("stroke-width", String(u.strokeWidth)), u.strokeDasharray && t.line.setAttribute("stroke-dasharray", u.strokeDasharray), u.strokeLinecap && t.line.setAttribute("stroke-linecap", u.strokeLinecap), u.opacity !== void 0 && t.line.setAttribute("opacity", String(u.opacity));
|
|
953
964
|
}
|
|
954
965
|
const f = t.querySelectorAll('path[stroke="transparent"]');
|
|
955
966
|
f.length > 0 && f[0].setAttribute("d", h);
|
|
956
|
-
const p =
|
|
967
|
+
const p = j(i, r, c, a);
|
|
957
968
|
if (p) {
|
|
958
|
-
const u = `M ${p.x1} ${p.y1} L ${c} ${
|
|
959
|
-
if (t.arrow1.setAttribute("d", u), f.length > 1 && f[1].setAttribute("d", u),
|
|
960
|
-
const g =
|
|
969
|
+
const u = `M ${p.x1} ${p.y1} L ${c} ${a} L ${p.x2} ${p.y2}`;
|
|
970
|
+
if (t.arrow1.setAttribute("d", u), f.length > 1 && f[1].setAttribute("d", u), d.style) {
|
|
971
|
+
const g = d.style;
|
|
961
972
|
g.stroke && t.arrow1.setAttribute("stroke", g.stroke), g.strokeWidth && t.arrow1.setAttribute("stroke-width", String(g.strokeWidth)), g.strokeLinecap && t.arrow1.setAttribute("stroke-linecap", g.strokeLinecap), g.opacity !== void 0 && t.arrow1.setAttribute("opacity", String(g.opacity));
|
|
962
973
|
}
|
|
963
974
|
}
|
|
964
|
-
if (
|
|
965
|
-
const u =
|
|
975
|
+
if (d.bidirectional) {
|
|
976
|
+
const u = j(o, s, e, n);
|
|
966
977
|
if (u) {
|
|
967
978
|
const g = `M ${u.x1} ${u.y1} L ${e} ${n} L ${u.x2} ${u.y2}`;
|
|
968
|
-
if (t.arrow2.setAttribute("d", g), f.length > 2 && f[2].setAttribute("d", g),
|
|
969
|
-
const b =
|
|
979
|
+
if (t.arrow2.setAttribute("d", g), f.length > 2 && f[2].setAttribute("d", g), d.style) {
|
|
980
|
+
const b = d.style;
|
|
970
981
|
b.stroke && t.arrow2.setAttribute("stroke", b.stroke), b.strokeWidth && t.arrow2.setAttribute("stroke-width", String(b.strokeWidth)), b.strokeLinecap && t.arrow2.setAttribute("stroke-linecap", b.strokeLinecap), b.opacity !== void 0 && t.arrow2.setAttribute("opacity", String(b.opacity));
|
|
971
982
|
}
|
|
972
983
|
}
|
|
973
984
|
}
|
|
974
|
-
const { x:
|
|
975
|
-
if (t.labelEl &&
|
|
985
|
+
const { x: w, y } = kt(e, n, o, s, i, r, c, a);
|
|
986
|
+
if (t.labelEl && ze(t.labelEl, w, y), d.style?.labelColor) {
|
|
976
987
|
const u = t.labelEl;
|
|
977
|
-
u && (u.style.color =
|
|
988
|
+
u && (u.style.color = d.style.labelColor);
|
|
978
989
|
}
|
|
979
|
-
|
|
990
|
+
Qe(t);
|
|
980
991
|
}
|
|
981
|
-
function
|
|
982
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
992
|
+
function U(t, e, n) {
|
|
993
|
+
const { offsetLeft: o, offsetTop: s } = N(t.nodes, e), i = e.offsetWidth, r = e.offsetHeight, c = o + i / 2, a = s + r / 2, d = c + n.x, h = a + n.y;
|
|
983
994
|
return {
|
|
984
995
|
w: i,
|
|
985
996
|
h: r,
|
|
986
997
|
cx: c,
|
|
987
|
-
cy:
|
|
988
|
-
ctrlX:
|
|
998
|
+
cy: a,
|
|
999
|
+
ctrlX: d,
|
|
989
1000
|
ctrlY: h
|
|
990
1001
|
};
|
|
991
1002
|
}
|
|
992
|
-
function
|
|
1003
|
+
function Y(t) {
|
|
993
1004
|
let e, n;
|
|
994
1005
|
const o = (t.cy - t.ctrlY) / (t.ctrlX - t.cx);
|
|
995
1006
|
return o > t.h / t.w || o < -t.h / t.w ? t.cy - t.ctrlY < 0 ? (e = t.cx - t.h / 2 / o, n = t.cy + t.h / 2) : (e = t.cx + t.h / 2 / o, n = t.cy - t.h / 2) : t.cx - t.ctrlX < 0 ? (e = t.cx + t.w / 2, n = t.cy - t.w * o / 2) : (e = t.cx - t.w / 2, n = t.cy + t.w * o / 2), {
|
|
@@ -997,74 +1008,74 @@ function X(t) {
|
|
|
997
1008
|
y: n
|
|
998
1009
|
};
|
|
999
1010
|
}
|
|
1000
|
-
const
|
|
1001
|
-
const o =
|
|
1011
|
+
const Fe = function(t, e, n) {
|
|
1012
|
+
const o = N(t.nodes, e), s = N(t.nodes, n), i = o.offsetLeft + e.offsetWidth / 2, r = o.offsetTop + e.offsetHeight / 2, c = s.offsetLeft + n.offsetWidth / 2, a = s.offsetTop + n.offsetHeight / 2, d = c - i, h = a - r, f = Math.sqrt(d * d + h * h), p = Math.max(50, Math.min(200, f * 0.3)), w = Math.abs(d), y = Math.abs(h);
|
|
1002
1013
|
let u, g;
|
|
1003
1014
|
if (f < 150) {
|
|
1004
1015
|
const v = e.closest("me-main").className === "lhs" ? -1 : 1;
|
|
1005
1016
|
u = { x: 200 * v, y: 0 }, g = { x: 200 * v, y: 0 };
|
|
1006
|
-
} else if (
|
|
1007
|
-
const v =
|
|
1008
|
-
u = { x: v + (
|
|
1009
|
-
} else if (y >
|
|
1010
|
-
const v = h > 0 ? e.offsetHeight / 2 : -e.offsetHeight / 2,
|
|
1011
|
-
u = { x: 0, y: v + (h > 0 ? p : -p) }, g = { x: 0, y:
|
|
1017
|
+
} else if (w > y * 1.5) {
|
|
1018
|
+
const v = d > 0 ? e.offsetWidth / 2 : -e.offsetWidth / 2, C = d > 0 ? -n.offsetWidth / 2 : n.offsetWidth / 2;
|
|
1019
|
+
u = { x: v + (d > 0 ? p : -p), y: 0 }, g = { x: C + (d > 0 ? -p : p), y: 0 };
|
|
1020
|
+
} else if (y > w * 1.5) {
|
|
1021
|
+
const v = h > 0 ? e.offsetHeight / 2 : -e.offsetHeight / 2, C = h > 0 ? -n.offsetHeight / 2 : n.offsetHeight / 2;
|
|
1022
|
+
u = { x: 0, y: v + (h > 0 ? p : -p) }, g = { x: 0, y: C + (h > 0 ? -p : p) };
|
|
1012
1023
|
} else {
|
|
1013
|
-
const v = Math.atan2(h,
|
|
1014
|
-
u = { x:
|
|
1024
|
+
const v = Math.atan2(h, d), C = e.offsetWidth / 2 * Math.cos(v), S = e.offsetHeight / 2 * Math.sin(v), T = -(n.offsetWidth / 2) * Math.cos(v), D = -(n.offsetHeight / 2) * Math.sin(v), l = p * 0.7 * (d > 0 ? 1 : -1), m = p * 0.7 * (h > 0 ? 1 : -1);
|
|
1025
|
+
u = { x: C + l, y: S + m }, g = { x: T - l, y: D - m };
|
|
1015
1026
|
}
|
|
1016
1027
|
return {
|
|
1017
1028
|
delta1: { x: Math.round(u.x), y: Math.round(u.y) },
|
|
1018
1029
|
delta2: { x: Math.round(g.x), y: Math.round(g.y) }
|
|
1019
1030
|
};
|
|
1020
|
-
},
|
|
1031
|
+
}, ct = function(t, e, n, o, s) {
|
|
1021
1032
|
if (!e || !n)
|
|
1022
1033
|
return;
|
|
1023
1034
|
if (!o.delta1 || !o.delta2) {
|
|
1024
|
-
const
|
|
1025
|
-
o.delta1 =
|
|
1035
|
+
const x = Fe(t, e, n);
|
|
1036
|
+
o.delta1 = x.delta1, o.delta2 = x.delta2;
|
|
1026
1037
|
}
|
|
1027
|
-
const i =
|
|
1038
|
+
const i = U(t, e, o.delta1), r = U(t, n, o.delta2), { x: c, y: a } = Y(i), { ctrlX: d, ctrlY: h } = i, { ctrlX: f, ctrlY: p } = r, { x: w, y } = Y(r), u = j(f, p, w, y);
|
|
1028
1039
|
if (!u) return;
|
|
1029
|
-
const g = `M ${u.x1} ${u.y1} L ${
|
|
1040
|
+
const g = `M ${u.x1} ${u.y1} L ${w} ${y} L ${u.x2} ${u.y2}`;
|
|
1030
1041
|
let b = "";
|
|
1031
1042
|
if (o.bidirectional) {
|
|
1032
|
-
const
|
|
1033
|
-
if (!
|
|
1034
|
-
b = `M ${
|
|
1043
|
+
const x = j(d, h, c, a);
|
|
1044
|
+
if (!x) return;
|
|
1045
|
+
b = `M ${x.x1} ${x.y1} L ${c} ${a} L ${x.x2} ${x.y2}`;
|
|
1035
1046
|
}
|
|
1036
|
-
const v =
|
|
1037
|
-
v.id =
|
|
1038
|
-
const
|
|
1047
|
+
const v = Me(`M ${c} ${a} C ${d} ${h} ${f} ${p} ${w} ${y}`, g, b, o.style), { x: C, y: S } = kt(c, a, d, h, f, p, w, y), T = o.style?.labelColor || "rgb(235, 95, 82)", D = "arrow-" + o.id;
|
|
1048
|
+
v.id = D;
|
|
1049
|
+
const l = t.markdown ? t.markdown(o.label, o) : o.label, m = et(l, C, S, {
|
|
1039
1050
|
anchor: "middle",
|
|
1040
1051
|
color: T,
|
|
1041
1052
|
dataType: "arrow",
|
|
1042
|
-
svgId:
|
|
1053
|
+
svgId: D
|
|
1043
1054
|
});
|
|
1044
|
-
v.labelEl =
|
|
1045
|
-
},
|
|
1055
|
+
v.labelEl = m, v.arrowObj = o, v.dataset.linkid = o.id, t.labelContainer.appendChild(m), t.linkSvgGroup.appendChild(v), J(m), s || (t.arrows.push(o), t.currentArrow = v, At(t, o, i, r));
|
|
1056
|
+
}, qe = function(t, e, n = {}) {
|
|
1046
1057
|
const o = {
|
|
1047
|
-
id:
|
|
1058
|
+
id: R(),
|
|
1048
1059
|
label: "Custom Link",
|
|
1049
1060
|
from: t.nodeObj.id,
|
|
1050
1061
|
to: e.nodeObj.id,
|
|
1051
1062
|
...n
|
|
1052
1063
|
};
|
|
1053
|
-
|
|
1064
|
+
ct(this, t, e, o), this.bus.fire("operation", {
|
|
1054
1065
|
name: "createArrow",
|
|
1055
1066
|
obj: o
|
|
1056
1067
|
});
|
|
1057
|
-
},
|
|
1058
|
-
|
|
1059
|
-
const e = { ...t, id:
|
|
1060
|
-
|
|
1068
|
+
}, _e = function(t) {
|
|
1069
|
+
Z(this);
|
|
1070
|
+
const e = { ...t, id: R() };
|
|
1071
|
+
ct(this, this.findEle(e.from), this.findEle(e.to), e), this.bus.fire("operation", {
|
|
1061
1072
|
name: "createArrow",
|
|
1062
1073
|
obj: e
|
|
1063
1074
|
});
|
|
1064
|
-
},
|
|
1075
|
+
}, je = function(t) {
|
|
1065
1076
|
let e;
|
|
1066
1077
|
if (t ? e = t : e = this.currentArrow, !e) return;
|
|
1067
|
-
|
|
1078
|
+
Z(this);
|
|
1068
1079
|
const n = e.arrowObj.id;
|
|
1069
1080
|
this.arrows = this.arrows.filter((o) => o.id !== n), e.labelEl?.remove(), e.remove(), this.bus.fire("operation", {
|
|
1070
1081
|
name: "removeArrow",
|
|
@@ -1072,14 +1083,14 @@ const qe = function(t, e, n) {
|
|
|
1072
1083
|
id: n
|
|
1073
1084
|
}
|
|
1074
1085
|
});
|
|
1075
|
-
},
|
|
1086
|
+
}, Ue = function(t) {
|
|
1076
1087
|
this.currentArrow = t;
|
|
1077
|
-
const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), s =
|
|
1078
|
-
At(this, e, s, i);
|
|
1079
|
-
},
|
|
1080
|
-
|
|
1081
|
-
},
|
|
1082
|
-
const n = document.createElementNS(
|
|
1088
|
+
const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), s = U(this, n, e.delta1), i = U(this, o, e.delta2);
|
|
1089
|
+
At(this, e, s, i), this.bus.fire("selectArrow", e);
|
|
1090
|
+
}, Ke = function() {
|
|
1091
|
+
Z(this), this.currentArrow = null, this.bus.fire("unselectArrow");
|
|
1092
|
+
}, tt = function(t, e) {
|
|
1093
|
+
const n = document.createElementNS(P, "path");
|
|
1083
1094
|
return M(n, {
|
|
1084
1095
|
d: t,
|
|
1085
1096
|
stroke: e,
|
|
@@ -1088,111 +1099,111 @@ const qe = function(t, e, n) {
|
|
|
1088
1099
|
"stroke-linecap": "round",
|
|
1089
1100
|
"stroke-linejoin": "round"
|
|
1090
1101
|
}), n;
|
|
1091
|
-
},
|
|
1092
|
-
const n = document.createElementNS(
|
|
1102
|
+
}, Je = function(t, e) {
|
|
1103
|
+
const n = document.createElementNS(P, "g");
|
|
1093
1104
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
1094
|
-
const o =
|
|
1105
|
+
const o = tt(t.line.getAttribute("d"), e);
|
|
1095
1106
|
n.appendChild(o);
|
|
1096
|
-
const s =
|
|
1107
|
+
const s = tt(t.arrow1.getAttribute("d"), e);
|
|
1097
1108
|
if (n.appendChild(s), t.arrow2.getAttribute("d")) {
|
|
1098
|
-
const i =
|
|
1109
|
+
const i = tt(t.arrow2.getAttribute("d"), e);
|
|
1099
1110
|
n.appendChild(i);
|
|
1100
1111
|
}
|
|
1101
1112
|
t.insertBefore(n, t.firstChild);
|
|
1102
|
-
},
|
|
1113
|
+
}, Ze = function(t) {
|
|
1103
1114
|
const e = t.querySelector(".arrow-highlight");
|
|
1104
1115
|
e && e.remove();
|
|
1105
|
-
},
|
|
1116
|
+
}, Qe = function(t) {
|
|
1106
1117
|
const e = t.querySelector(".arrow-highlight");
|
|
1107
1118
|
if (!e) return;
|
|
1108
1119
|
const n = e.querySelectorAll("path");
|
|
1109
1120
|
n.length >= 1 && n[0].setAttribute("d", t.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", t.arrow1.getAttribute("d")), n.length >= 3 && t.arrow2.getAttribute("d") && n[2].setAttribute("d", t.arrow2.getAttribute("d"));
|
|
1110
|
-
},
|
|
1111
|
-
t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow &&
|
|
1121
|
+
}, Z = function(t) {
|
|
1122
|
+
t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow && Ze(t.currentArrow);
|
|
1112
1123
|
}, At = function(t, e, n, o) {
|
|
1113
|
-
const { linkController: s, P2: i, P3: r, line1: c, line2:
|
|
1124
|
+
const { linkController: s, P2: i, P3: r, line1: c, line2: a, nodes: d, map: h, currentArrow: f, bus: p } = t;
|
|
1114
1125
|
if (!f) return;
|
|
1115
|
-
s.style.display = "initial", i.style.display = "initial", r.style.display = "initial",
|
|
1116
|
-
let { x:
|
|
1117
|
-
i.style.cssText = `top:${g}px;left:${u}px;`, r.style.cssText = `top:${v}px;left:${b}px;`,
|
|
1118
|
-
u = u + T / t.scaleVal, g = g +
|
|
1119
|
-
const
|
|
1120
|
-
|
|
1121
|
-
}), t.helper2.init(h, (T,
|
|
1122
|
-
b = b + T / t.scaleVal, v = v +
|
|
1123
|
-
const
|
|
1124
|
-
|
|
1126
|
+
s.style.display = "initial", i.style.display = "initial", r.style.display = "initial", d.appendChild(s), d.appendChild(i), d.appendChild(r), Je(f, Ge);
|
|
1127
|
+
let { x: w, y } = Y(n), { ctrlX: u, ctrlY: g } = n, { ctrlX: b, ctrlY: v } = o, { x: C, y: S } = Y(o);
|
|
1128
|
+
i.style.cssText = `top:${g}px;left:${u}px;`, r.style.cssText = `top:${v}px;left:${b}px;`, z(c, w, y, u, g), z(a, b, v, C, S), t.helper1 = gt.create(i), t.helper2 = gt.create(r), t.helper1.init(h, (T, D) => {
|
|
1129
|
+
u = u + T / t.scaleVal, g = g + D / t.scaleVal;
|
|
1130
|
+
const l = Y({ ...n, ctrlX: u, ctrlY: g });
|
|
1131
|
+
w = l.x, y = l.y, i.style.top = g + "px", i.style.left = u + "px", mt(f, w, y, u, g, b, v, C, S, e), z(c, w, y, u, g), e.delta1.x = Math.round(u - n.cx), e.delta1.y = Math.round(g - n.cy), p.fire("updateArrowDelta", e);
|
|
1132
|
+
}), t.helper2.init(h, (T, D) => {
|
|
1133
|
+
b = b + T / t.scaleVal, v = v + D / t.scaleVal;
|
|
1134
|
+
const l = Y({ ...o, ctrlX: b, ctrlY: v });
|
|
1135
|
+
C = l.x, S = l.y, r.style.top = v + "px", r.style.left = b + "px", mt(f, w, y, u, g, b, v, C, S, e), z(a, b, v, C, S), e.delta2.x = Math.round(b - o.cx), e.delta2.y = Math.round(v - o.cy), p.fire("updateArrowDelta", e);
|
|
1125
1136
|
});
|
|
1126
1137
|
};
|
|
1127
|
-
function
|
|
1138
|
+
function tn() {
|
|
1128
1139
|
this.linkSvgGroup.innerHTML = "", this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach((e) => e.remove());
|
|
1129
1140
|
for (let e = 0; e < this.arrows.length; e++) {
|
|
1130
1141
|
const n = this.arrows[e];
|
|
1131
1142
|
try {
|
|
1132
|
-
|
|
1143
|
+
ct(this, this.findEle(n.from), this.findEle(n.to), n, !0);
|
|
1133
1144
|
} catch {
|
|
1134
1145
|
}
|
|
1135
1146
|
}
|
|
1136
1147
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
1137
1148
|
}
|
|
1138
|
-
function
|
|
1139
|
-
|
|
1149
|
+
function en(t) {
|
|
1150
|
+
Z(this), t && t.labelEl && Dt(this, t.labelEl, t.arrowObj);
|
|
1140
1151
|
}
|
|
1141
|
-
function
|
|
1142
|
-
this.arrows = this.arrows.filter((t) =>
|
|
1152
|
+
function nn() {
|
|
1153
|
+
this.arrows = this.arrows.filter((t) => _(t.from, this.nodeData) && _(t.to, this.nodeData));
|
|
1143
1154
|
}
|
|
1144
|
-
const
|
|
1155
|
+
const on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1145
1156
|
__proto__: null,
|
|
1146
|
-
createArrow:
|
|
1147
|
-
createArrowFrom:
|
|
1148
|
-
editArrowLabel:
|
|
1149
|
-
removeArrow:
|
|
1150
|
-
renderArrow:
|
|
1151
|
-
selectArrow:
|
|
1152
|
-
tidyArrow:
|
|
1153
|
-
unselectArrow:
|
|
1154
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1157
|
+
createArrow: qe,
|
|
1158
|
+
createArrowFrom: _e,
|
|
1159
|
+
editArrowLabel: en,
|
|
1160
|
+
removeArrow: je,
|
|
1161
|
+
renderArrow: tn,
|
|
1162
|
+
selectArrow: Ue,
|
|
1163
|
+
tidyArrow: nn,
|
|
1164
|
+
unselectArrow: Ke
|
|
1165
|
+
}, Symbol.toStringTag, { value: "Module" })), sn = function(t) {
|
|
1155
1166
|
if (t.length === 0) throw new Error("No selected node.");
|
|
1156
1167
|
if (t.length === 1) {
|
|
1157
|
-
const
|
|
1158
|
-
if (!
|
|
1159
|
-
const h =
|
|
1168
|
+
const a = t[0].nodeObj, d = t[0].nodeObj.parent;
|
|
1169
|
+
if (!d) throw new Error("Can not select root node.");
|
|
1170
|
+
const h = d.children.findIndex((f) => a === f);
|
|
1160
1171
|
return {
|
|
1161
|
-
parent:
|
|
1172
|
+
parent: d.id,
|
|
1162
1173
|
start: h,
|
|
1163
1174
|
end: h
|
|
1164
1175
|
};
|
|
1165
1176
|
}
|
|
1166
1177
|
let e = 0;
|
|
1167
|
-
const n = t.map((
|
|
1168
|
-
let
|
|
1178
|
+
const n = t.map((a) => {
|
|
1179
|
+
let d = a.nodeObj;
|
|
1169
1180
|
const h = [];
|
|
1170
|
-
for (;
|
|
1171
|
-
const f =
|
|
1172
|
-
|
|
1181
|
+
for (; d.parent; ) {
|
|
1182
|
+
const f = d.parent, w = f.children?.indexOf(d);
|
|
1183
|
+
d = f, h.unshift({ node: d, index: w });
|
|
1173
1184
|
}
|
|
1174
1185
|
return h.length > e && (e = h.length), h;
|
|
1175
1186
|
});
|
|
1176
1187
|
let o = 0;
|
|
1177
1188
|
t: for (; o < e; o++) {
|
|
1178
|
-
const
|
|
1179
|
-
for (let
|
|
1180
|
-
if (n[
|
|
1189
|
+
const a = n[0][o]?.node;
|
|
1190
|
+
for (let d = 1; d < n.length; d++)
|
|
1191
|
+
if (n[d][o]?.node !== a)
|
|
1181
1192
|
break t;
|
|
1182
1193
|
}
|
|
1183
1194
|
if (!o) throw new Error("Can not select root node.");
|
|
1184
|
-
const s = n.map((
|
|
1195
|
+
const s = n.map((a) => a[o - 1].index).sort(), i = s[0] || 0, r = s[s.length - 1] || 0, c = n[0][o - 1].node;
|
|
1185
1196
|
if (!c.parent) throw new Error("Please select nodes in the same main topic.");
|
|
1186
1197
|
return {
|
|
1187
1198
|
parent: c.id,
|
|
1188
1199
|
start: i,
|
|
1189
1200
|
end: r
|
|
1190
1201
|
};
|
|
1191
|
-
},
|
|
1192
|
-
const e = document.createElementNS(
|
|
1202
|
+
}, rn = function(t) {
|
|
1203
|
+
const e = document.createElementNS(P, "g");
|
|
1193
1204
|
return e.setAttribute("id", t), e;
|
|
1194
|
-
},
|
|
1195
|
-
const n = document.createElementNS(
|
|
1205
|
+
}, yt = function(t, e) {
|
|
1206
|
+
const n = document.createElementNS(P, "path");
|
|
1196
1207
|
return M(n, {
|
|
1197
1208
|
d: t,
|
|
1198
1209
|
stroke: e || "#666",
|
|
@@ -1200,101 +1211,101 @@ const rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1200
1211
|
"stroke-linecap": "round",
|
|
1201
1212
|
"stroke-width": "2"
|
|
1202
1213
|
}), n;
|
|
1203
|
-
},
|
|
1214
|
+
}, cn = (t) => t.parentElement.parentElement, ln = function(t, { parent: e, start: n }) {
|
|
1204
1215
|
const o = t.findEle(e), s = o.nodeObj;
|
|
1205
1216
|
let i;
|
|
1206
1217
|
return s.parent ? i = o.closest("me-main").className : i = t.findEle(s.children[n].id).closest("me-main").className, i;
|
|
1207
|
-
},
|
|
1208
|
-
const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes:
|
|
1218
|
+
}, lt = function(t, e) {
|
|
1219
|
+
const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes: a, theme: d, summarySvg: h } = t, p = t.findEle(s).nodeObj, w = ln(t, e);
|
|
1209
1220
|
let y = 1 / 0, u = 0, g = 0, b = 0;
|
|
1210
|
-
for (let
|
|
1211
|
-
const
|
|
1212
|
-
if (!
|
|
1221
|
+
for (let A = i; A <= r; A++) {
|
|
1222
|
+
const H = p.children?.[A];
|
|
1223
|
+
if (!H)
|
|
1213
1224
|
return t.removeSummary(n), null;
|
|
1214
|
-
const
|
|
1215
|
-
|
|
1225
|
+
const X = cn(t.findEle(H.id)), { offsetLeft: V, offsetTop: at } = N(a, X), dt = i === r ? 10 : 20;
|
|
1226
|
+
A === i && (g = at + dt), A === r && (b = at + X.offsetHeight - dt), V < y && (y = V), X.offsetWidth + V > u && (u = X.offsetWidth + V);
|
|
1216
1227
|
}
|
|
1217
|
-
let v,
|
|
1218
|
-
const S = p.parent ? 10 : 0, T = g + S,
|
|
1219
|
-
|
|
1220
|
-
const
|
|
1221
|
-
return
|
|
1222
|
-
},
|
|
1228
|
+
let v, C;
|
|
1229
|
+
const S = p.parent ? 10 : 0, T = g + S, D = b + S, l = (T + D) / 2, m = c?.stroke || d.cssVar["--color"], x = c?.labelColor || d.cssVar["--color"], L = "s-" + n, I = t.markdown ? t.markdown(o, e) : o;
|
|
1230
|
+
w === B.LHS ? (v = yt(`M ${y + 10} ${T} c -5 0 -10 5 -10 10 L ${y} ${D - 10} c 0 5 5 10 10 10 M ${y} ${l} h -10`, m), C = et(I, y - 20, l, { anchor: "end", color: x, dataType: "summary", svgId: L })) : (v = yt(`M ${u - 10} ${T} c 5 0 10 5 10 10 L ${u} ${D - 10} c 0 5 -5 10 -10 10 M ${u} ${l} h 10`, m), C = et(I, u + 20, l, { anchor: "start", color: x, dataType: "summary", svgId: L }));
|
|
1231
|
+
const E = rn(L);
|
|
1232
|
+
return E.appendChild(v), t.labelContainer.appendChild(C), J(C), E.summaryObj = e, E.labelEl = C, h.appendChild(E), E;
|
|
1233
|
+
}, an = function(t = {}) {
|
|
1223
1234
|
if (!this.currentNodes) return;
|
|
1224
|
-
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } =
|
|
1225
|
-
n.push(c), this.editSummary(
|
|
1235
|
+
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } = sn(e), c = { id: R(), parent: s, start: i, end: r, label: "summary", style: t.style }, a = lt(this, c);
|
|
1236
|
+
n.push(c), this.editSummary(a), o.fire("operation", {
|
|
1226
1237
|
name: "createSummary",
|
|
1227
1238
|
obj: c
|
|
1228
1239
|
});
|
|
1229
|
-
},
|
|
1230
|
-
const e =
|
|
1231
|
-
|
|
1240
|
+
}, dn = function(t) {
|
|
1241
|
+
const e = R(), n = { ...t, id: e };
|
|
1242
|
+
lt(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
1232
1243
|
name: "createSummary",
|
|
1233
1244
|
obj: n
|
|
1234
1245
|
});
|
|
1235
|
-
},
|
|
1246
|
+
}, hn = function(t) {
|
|
1236
1247
|
const e = this.summaries.findIndex((n) => n.id === t);
|
|
1237
1248
|
e > -1 && (this.summaries.splice(e, 1), this.nodes.querySelector("#s-" + t)?.remove(), this.nodes.querySelector("#label-s-" + t)?.remove()), this.bus.fire("operation", {
|
|
1238
1249
|
name: "removeSummary",
|
|
1239
1250
|
obj: { id: t }
|
|
1240
1251
|
});
|
|
1241
|
-
},
|
|
1252
|
+
}, fn = function(t) {
|
|
1242
1253
|
const e = t.labelEl;
|
|
1243
|
-
e && e.classList.add("selected"), this.currentSummary = t;
|
|
1244
|
-
},
|
|
1245
|
-
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
|
|
1246
|
-
},
|
|
1254
|
+
e && e.classList.add("selected"), this.currentSummary = t, this.bus.fire("selectSummary", t.summaryObj);
|
|
1255
|
+
}, un = function() {
|
|
1256
|
+
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null, this.bus.fire("unselectSummary");
|
|
1257
|
+
}, pn = function() {
|
|
1247
1258
|
this.summarySvg.innerHTML = "", this.summaries.forEach((t) => {
|
|
1248
1259
|
try {
|
|
1249
|
-
|
|
1260
|
+
lt(this, t);
|
|
1250
1261
|
} catch {
|
|
1251
1262
|
}
|
|
1252
1263
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
1253
|
-
},
|
|
1254
|
-
t && t.labelEl &&
|
|
1255
|
-
},
|
|
1264
|
+
}, gn = function(t) {
|
|
1265
|
+
t && t.labelEl && Dt(this, t.labelEl, t.summaryObj);
|
|
1266
|
+
}, mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1256
1267
|
__proto__: null,
|
|
1257
|
-
createSummary:
|
|
1258
|
-
createSummaryFrom:
|
|
1259
|
-
editSummary:
|
|
1260
|
-
removeSummary:
|
|
1261
|
-
renderSummary:
|
|
1262
|
-
selectSummary:
|
|
1263
|
-
unselectSummary:
|
|
1264
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1265
|
-
function
|
|
1266
|
-
const n = document.createElementNS(
|
|
1268
|
+
createSummary: an,
|
|
1269
|
+
createSummaryFrom: dn,
|
|
1270
|
+
editSummary: gn,
|
|
1271
|
+
removeSummary: hn,
|
|
1272
|
+
renderSummary: pn,
|
|
1273
|
+
selectSummary: fn,
|
|
1274
|
+
unselectSummary: un
|
|
1275
|
+
}, Symbol.toStringTag, { value: "Module" })), k = "http://www.w3.org/2000/svg";
|
|
1276
|
+
function yn(t, e) {
|
|
1277
|
+
const n = document.createElementNS(k, "svg");
|
|
1267
1278
|
return M(n, {
|
|
1268
1279
|
version: "1.1",
|
|
1269
|
-
xmlns:
|
|
1280
|
+
xmlns: k,
|
|
1270
1281
|
height: t,
|
|
1271
1282
|
width: e
|
|
1272
1283
|
}), n;
|
|
1273
1284
|
}
|
|
1274
|
-
function
|
|
1285
|
+
function wn(t, e) {
|
|
1275
1286
|
return (parseInt(t) - parseInt(e)) / 2;
|
|
1276
1287
|
}
|
|
1277
|
-
function
|
|
1278
|
-
const s = document.createElementNS(
|
|
1288
|
+
function vn(t, e, n, o) {
|
|
1289
|
+
const s = document.createElementNS(k, "g");
|
|
1279
1290
|
let i = "";
|
|
1280
1291
|
return t.text ? i = t.text.textContent : i = t.childNodes[0].textContent, i.split(`
|
|
1281
|
-
`).forEach((c,
|
|
1282
|
-
const
|
|
1283
|
-
M(
|
|
1292
|
+
`).forEach((c, a) => {
|
|
1293
|
+
const d = document.createElementNS(k, "text");
|
|
1294
|
+
M(d, {
|
|
1284
1295
|
x: n + parseInt(e.paddingLeft) + "",
|
|
1285
|
-
y: o + parseInt(e.paddingTop) +
|
|
1296
|
+
y: o + parseInt(e.paddingTop) + wn(e.lineHeight, e.fontSize) * (a + 1) + parseFloat(e.fontSize) * (a + 1) + "",
|
|
1286
1297
|
"text-anchor": "start",
|
|
1287
1298
|
"font-family": e.fontFamily,
|
|
1288
1299
|
"font-size": `${e.fontSize}`,
|
|
1289
1300
|
"font-weight": `${e.fontWeight}`,
|
|
1290
1301
|
fill: `${e.color}`
|
|
1291
|
-
}),
|
|
1302
|
+
}), d.innerHTML = c, s.appendChild(d);
|
|
1292
1303
|
}), s;
|
|
1293
1304
|
}
|
|
1294
|
-
function
|
|
1305
|
+
function bn(t, e, n, o) {
|
|
1295
1306
|
let s = "";
|
|
1296
1307
|
t.nodeObj?.dangerouslySetInnerHTML ? s = t.nodeObj.dangerouslySetInnerHTML : t.text ? s = t.text.textContent : s = t.childNodes[0].textContent;
|
|
1297
|
-
const i = document.createElementNS(
|
|
1308
|
+
const i = document.createElementNS(k, "foreignObject");
|
|
1298
1309
|
M(i, {
|
|
1299
1310
|
x: n + parseInt(e.paddingLeft) + "",
|
|
1300
1311
|
y: o + parseInt(e.paddingTop) + "",
|
|
@@ -1307,8 +1318,8 @@ function Cn(t, e, n, o) {
|
|
|
1307
1318
|
style: `font-family: ${e.fontFamily}; font-size: ${e.fontSize}; font-weight: ${e.fontWeight}; color: ${e.color}; white-space: pre-wrap;`
|
|
1308
1319
|
}), r.innerHTML = s, i.appendChild(r), i;
|
|
1309
1320
|
}
|
|
1310
|
-
function
|
|
1311
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } =
|
|
1321
|
+
function xn(t, e) {
|
|
1322
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = N(t.nodes, e), i = document.createElementNS(k, "rect");
|
|
1312
1323
|
return M(i, {
|
|
1313
1324
|
x: o + "",
|
|
1314
1325
|
y: s + "",
|
|
@@ -1321,8 +1332,8 @@ function En(t, e) {
|
|
|
1321
1332
|
"stroke-width": n.borderWidth
|
|
1322
1333
|
}), i;
|
|
1323
1334
|
}
|
|
1324
|
-
function
|
|
1325
|
-
const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } =
|
|
1335
|
+
function F(t, e, n = !1) {
|
|
1336
|
+
const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } = N(t.nodes, e), r = document.createElementNS(k, "rect");
|
|
1326
1337
|
M(r, {
|
|
1327
1338
|
x: s + "",
|
|
1328
1339
|
y: i + "",
|
|
@@ -1334,13 +1345,13 @@ function U(t, e, n = !1) {
|
|
|
1334
1345
|
stroke: o.borderColor,
|
|
1335
1346
|
"stroke-width": o.borderWidth
|
|
1336
1347
|
});
|
|
1337
|
-
const c = document.createElementNS(
|
|
1348
|
+
const c = document.createElementNS(k, "g");
|
|
1338
1349
|
c.appendChild(r);
|
|
1339
|
-
let
|
|
1340
|
-
return n ?
|
|
1350
|
+
let a;
|
|
1351
|
+
return n ? a = bn(e, o, s, i) : a = vn(e, o, s, i), c.appendChild(a), c;
|
|
1341
1352
|
}
|
|
1342
|
-
function
|
|
1343
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } =
|
|
1353
|
+
function Cn(t, e) {
|
|
1354
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = N(t.nodes, e), i = document.createElementNS(k, "a"), r = document.createElementNS(k, "text");
|
|
1344
1355
|
return M(r, {
|
|
1345
1356
|
x: o + "",
|
|
1346
1357
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -1351,8 +1362,8 @@ function Sn(t, e) {
|
|
|
1351
1362
|
fill: `${n.color}`
|
|
1352
1363
|
}), r.innerHTML = e.textContent, i.appendChild(r), i.setAttribute("href", e.href), i;
|
|
1353
1364
|
}
|
|
1354
|
-
function
|
|
1355
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } =
|
|
1365
|
+
function En(t, e) {
|
|
1366
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = N(t.nodes, e), i = document.createElementNS(k, "image");
|
|
1356
1367
|
return M(i, {
|
|
1357
1368
|
x: o + "",
|
|
1358
1369
|
y: s + "",
|
|
@@ -1361,8 +1372,8 @@ function Tn(t, e) {
|
|
|
1361
1372
|
href: e.src
|
|
1362
1373
|
}), i;
|
|
1363
1374
|
}
|
|
1364
|
-
const
|
|
1365
|
-
const n = t.nodes, o = n.offsetHeight +
|
|
1375
|
+
const q = 100, Sn = '<?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">', Tn = (t, e = !1) => {
|
|
1376
|
+
const n = t.nodes, o = n.offsetHeight + q * 2, s = n.offsetWidth + q * 2, i = yn(o + "px", s + "px"), r = document.createElementNS(k, "svg"), c = document.createElementNS(k, "rect");
|
|
1366
1377
|
M(c, {
|
|
1367
1378
|
x: "0",
|
|
1368
1379
|
y: "0",
|
|
@@ -1370,31 +1381,31 @@ const K = 100, Ln = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "
|
|
|
1370
1381
|
height: `${o}`,
|
|
1371
1382
|
fill: t.theme.cssVar["--bgcolor"]
|
|
1372
1383
|
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((f) => {
|
|
1373
|
-
const p = f.cloneNode(!0), { offsetLeft:
|
|
1374
|
-
p.setAttribute("x", `${
|
|
1384
|
+
const p = f.cloneNode(!0), { offsetLeft: w, offsetTop: y } = N(n, f.parentElement);
|
|
1385
|
+
p.setAttribute("x", `${w}`), p.setAttribute("y", `${y}`), r.appendChild(p);
|
|
1375
1386
|
});
|
|
1376
|
-
const
|
|
1377
|
-
d && r.appendChild(d);
|
|
1378
|
-
const a = n.querySelector(".topiclinks")?.cloneNode(!0);
|
|
1387
|
+
const a = n.querySelector(".lines")?.cloneNode(!0);
|
|
1379
1388
|
a && r.appendChild(a);
|
|
1389
|
+
const d = n.querySelector(".topiclinks")?.cloneNode(!0);
|
|
1390
|
+
d && r.appendChild(d);
|
|
1380
1391
|
const h = n.querySelector(".summary")?.cloneNode(!0);
|
|
1381
1392
|
return h && r.appendChild(h), n.querySelectorAll("me-tpc").forEach((f) => {
|
|
1382
|
-
f.nodeObj.dangerouslySetInnerHTML ? r.appendChild(
|
|
1393
|
+
f.nodeObj.dangerouslySetInnerHTML ? r.appendChild(F(t, f, !e)) : (r.appendChild(xn(t, f)), r.appendChild(F(t, f.text, !e)));
|
|
1383
1394
|
}), n.querySelectorAll(".tags > span").forEach((f) => {
|
|
1384
|
-
r.appendChild(
|
|
1395
|
+
r.appendChild(F(t, f));
|
|
1385
1396
|
}), n.querySelectorAll(".icons > span").forEach((f) => {
|
|
1386
|
-
r.appendChild(
|
|
1397
|
+
r.appendChild(F(t, f));
|
|
1387
1398
|
}), n.querySelectorAll(".hyper-link").forEach((f) => {
|
|
1388
|
-
r.appendChild(
|
|
1399
|
+
r.appendChild(Cn(t, f));
|
|
1389
1400
|
}), n.querySelectorAll("img").forEach((f) => {
|
|
1390
|
-
r.appendChild(
|
|
1401
|
+
r.appendChild(En(t, f));
|
|
1391
1402
|
}), M(r, {
|
|
1392
|
-
x:
|
|
1393
|
-
y:
|
|
1403
|
+
x: q + "",
|
|
1404
|
+
y: q + "",
|
|
1394
1405
|
overflow: "visible"
|
|
1395
1406
|
}), i.appendChild(r), i;
|
|
1396
|
-
},
|
|
1397
|
-
function
|
|
1407
|
+
}, Ln = (t, e) => (e && t.insertAdjacentHTML("afterbegin", "<style>" + e + "</style>"), Sn + t.outerHTML);
|
|
1408
|
+
function Dn(t) {
|
|
1398
1409
|
return new Promise((e, n) => {
|
|
1399
1410
|
const o = new FileReader();
|
|
1400
1411
|
o.onload = (s) => {
|
|
@@ -1404,11 +1415,11 @@ function kn(t) {
|
|
|
1404
1415
|
}, o.readAsDataURL(t);
|
|
1405
1416
|
});
|
|
1406
1417
|
}
|
|
1407
|
-
const
|
|
1408
|
-
const n =
|
|
1418
|
+
const Mn = function(t = !1, e) {
|
|
1419
|
+
const n = Tn(this, t), o = Ln(n, e);
|
|
1409
1420
|
return new Blob([o], { type: "image/svg+xml" });
|
|
1410
|
-
},
|
|
1411
|
-
const n = this.exportSvg(t, e), o = await
|
|
1421
|
+
}, kn = async function(t = !1, e) {
|
|
1422
|
+
const n = this.exportSvg(t, e), o = await Dn(n);
|
|
1412
1423
|
return new Promise((s, i) => {
|
|
1413
1424
|
const r = new Image();
|
|
1414
1425
|
r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
|
|
@@ -1418,52 +1429,52 @@ const Nn = function(t = !1, e) {
|
|
|
1418
1429
|
});
|
|
1419
1430
|
}, An = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1420
1431
|
__proto__: null,
|
|
1421
|
-
exportPng:
|
|
1422
|
-
exportSvg:
|
|
1423
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1424
|
-
getObjById:
|
|
1425
|
-
generateNewObj:
|
|
1426
|
-
layout:
|
|
1427
|
-
linkDiv:
|
|
1428
|
-
editTopic:
|
|
1429
|
-
createWrapper:
|
|
1430
|
-
createParent:
|
|
1431
|
-
createChildren:
|
|
1432
|
-
createTopic:
|
|
1433
|
-
findEle:
|
|
1434
|
-
changeTheme:
|
|
1435
|
-
...
|
|
1436
|
-
|
|
1437
|
-
...
|
|
1438
|
-
...
|
|
1432
|
+
exportPng: kn,
|
|
1433
|
+
exportSvg: Mn
|
|
1434
|
+
}, Symbol.toStringTag, { value: "Module" })), Nn = {}, Pn = {
|
|
1435
|
+
getObjById: _,
|
|
1436
|
+
generateNewObj: Pt,
|
|
1437
|
+
layout: Rt,
|
|
1438
|
+
linkDiv: ke,
|
|
1439
|
+
editTopic: _t,
|
|
1440
|
+
createWrapper: Gt,
|
|
1441
|
+
createParent: zt,
|
|
1442
|
+
createChildren: Ft,
|
|
1443
|
+
createTopic: qt,
|
|
1444
|
+
findEle: Ct,
|
|
1445
|
+
changeTheme: Xe,
|
|
1446
|
+
...ve,
|
|
1447
|
+
...Nn,
|
|
1448
|
+
...on,
|
|
1449
|
+
...mn,
|
|
1439
1450
|
...An,
|
|
1440
1451
|
init(t) {
|
|
1441
1452
|
if (t = JSON.parse(JSON.stringify(t)), !t || !t.nodeData) return new Error("MindElixir: `data` is required");
|
|
1442
|
-
t.direction !== void 0 && (this.direction = t.direction), this.changeTheme(t.theme || this.theme, !1), this.nodeData = t.nodeData,
|
|
1453
|
+
t.direction !== void 0 && (this.direction = t.direction), this.changeTheme(t.theme || this.theme, !1), this.nodeData = t.nodeData, st(this.nodeData), this.arrows = t.arrows || [], this.summaries = t.summaries || [], this.tidyArrow(), this.toolBar && Re(this), this.layout(), this.linkDiv(), this.toCenter();
|
|
1443
1454
|
},
|
|
1444
1455
|
destroy() {
|
|
1445
1456
|
this.disposable.forEach((t) => t()), this.el && (this.el.innerHTML = ""), this.el = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, this.selection?.destroy(), this.selection = void 0;
|
|
1446
1457
|
}
|
|
1447
1458
|
};
|
|
1448
|
-
function
|
|
1459
|
+
function $n({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: a, containerHeight: d }) {
|
|
1449
1460
|
let h = e + n / 2;
|
|
1450
1461
|
const f = t + o / 2;
|
|
1451
1462
|
let p;
|
|
1452
|
-
|
|
1453
|
-
const
|
|
1454
|
-
return
|
|
1463
|
+
a === B.LHS ? p = i + r : p = i;
|
|
1464
|
+
const w = s + c / 2, u = (1 - Math.abs(w - f) / d) * 0.25 * (n / 2);
|
|
1465
|
+
return a === B.LHS ? h = h - n / 10 - u : h = h + n / 10 + u, `M ${h} ${f} Q ${h} ${w} ${p} ${w}`;
|
|
1455
1466
|
}
|
|
1456
|
-
function
|
|
1467
|
+
function Hn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: a, isFirst: d }) {
|
|
1457
1468
|
const h = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
1458
1469
|
let f = 0, p = 0;
|
|
1459
|
-
|
|
1460
|
-
const
|
|
1470
|
+
d ? f = t + o / 2 : f = t + o;
|
|
1471
|
+
const w = s + c;
|
|
1461
1472
|
let y = 0, u = 0, g = 0;
|
|
1462
|
-
const b = Math.abs(f -
|
|
1463
|
-
return
|
|
1473
|
+
const b = Math.abs(f - w) / 300 * h;
|
|
1474
|
+
return a === B.LHS ? (g = e, y = g + h, u = g - h, p = i + h, `M ${y} ${f} C ${g} ${f} ${g + b} ${w} ${u} ${w} H ${p}`) : (g = e + n, y = g - h, u = g + h, p = i + r - h, `M ${y} ${f} C ${g} ${f} ${g - b} ${w} ${u} ${w} H ${p}`);
|
|
1464
1475
|
}
|
|
1465
|
-
const
|
|
1466
|
-
function
|
|
1476
|
+
const In = "5.11.1-beta.0";
|
|
1477
|
+
function On(t) {
|
|
1467
1478
|
return {
|
|
1468
1479
|
x: 0,
|
|
1469
1480
|
y: 0,
|
|
@@ -1478,7 +1489,7 @@ function Bn(t) {
|
|
|
1478
1489
|
}
|
|
1479
1490
|
};
|
|
1480
1491
|
}
|
|
1481
|
-
function
|
|
1492
|
+
function $({
|
|
1482
1493
|
el: t,
|
|
1483
1494
|
direction: e,
|
|
1484
1495
|
editable: n,
|
|
@@ -1487,50 +1498,50 @@ function O({
|
|
|
1487
1498
|
keypress: i,
|
|
1488
1499
|
mouseSelectionButton: r,
|
|
1489
1500
|
selectionContainer: c,
|
|
1490
|
-
before:
|
|
1491
|
-
newTopicName:
|
|
1501
|
+
before: a,
|
|
1502
|
+
newTopicName: d,
|
|
1492
1503
|
allowUndo: h,
|
|
1493
1504
|
generateMainBranch: f,
|
|
1494
1505
|
generateSubBranch: p,
|
|
1495
|
-
overflowHidden:
|
|
1506
|
+
overflowHidden: w,
|
|
1496
1507
|
theme: y,
|
|
1497
1508
|
alignment: u,
|
|
1498
1509
|
scaleSensitivity: g,
|
|
1499
1510
|
scaleMax: b,
|
|
1500
1511
|
scaleMin: v,
|
|
1501
|
-
handleWheel:
|
|
1512
|
+
handleWheel: C,
|
|
1502
1513
|
markdown: S,
|
|
1503
1514
|
imageProxy: T,
|
|
1504
|
-
pasteHandler:
|
|
1515
|
+
pasteHandler: D
|
|
1505
1516
|
}) {
|
|
1506
|
-
let
|
|
1507
|
-
const
|
|
1508
|
-
if (
|
|
1509
|
-
|
|
1510
|
-
const
|
|
1511
|
-
this.theme = y || (
|
|
1512
|
-
const
|
|
1513
|
-
|
|
1517
|
+
let l = null;
|
|
1518
|
+
const m = Object.prototype.toString.call(t);
|
|
1519
|
+
if (m === "[object HTMLDivElement]" ? l = t : m === "[object String]" && (l = document.querySelector(t)), !l) throw new Error("MindElixir: el is not a valid element");
|
|
1520
|
+
l.style.position = "relative", l.innerHTML = "", this.el = l, this.disposable = [], this.before = a || {}, this.newTopicName = d || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = r ?? 0, this.direction = e ?? 1, this.editable = n ?? !0, this.allowUndo = h ?? !0, this.scaleSensitivity = g ?? 0.1, this.scaleMax = b ?? 1.4, this.scaleMin = v ?? 0.2, this.generateMainBranch = f || $n, this.generateSubBranch = p || Hn, this.overflowHidden = w ?? !1, this.alignment = u ?? "root", this.handleWheel = C ?? !0, this.markdown = S || void 0, this.imageProxy = T || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.panHelper = On(this), this.bus = De(), this.container = document.createElement("div"), this.selectionContainer = c || this.container, this.container.className = "map-container";
|
|
1521
|
+
const x = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1522
|
+
this.theme = y || (x.matches ? ot : nt);
|
|
1523
|
+
const L = document.createElement("div");
|
|
1524
|
+
L.className = "map-canvas", this.map = L, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines = W("lines"), this.summarySvg = W("summary"), this.linkController = W("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 = pt(), this.line2 = pt(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = W("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(Le(this)), D && (this.pasteHandler = D);
|
|
1514
1525
|
}
|
|
1515
|
-
|
|
1516
|
-
Object.defineProperty(
|
|
1526
|
+
$.prototype = Pn;
|
|
1527
|
+
Object.defineProperty($.prototype, "currentNode", {
|
|
1517
1528
|
get() {
|
|
1518
1529
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
1519
1530
|
},
|
|
1520
1531
|
enumerable: !0
|
|
1521
1532
|
});
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1533
|
+
$.LEFT = 0;
|
|
1534
|
+
$.RIGHT = 1;
|
|
1535
|
+
$.SIDE = 2;
|
|
1536
|
+
$.THEME = nt;
|
|
1537
|
+
$.DARK_THEME = ot;
|
|
1538
|
+
$.version = In;
|
|
1539
|
+
$.E = Ct;
|
|
1529
1540
|
export {
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1541
|
+
ot as DARK_THEME,
|
|
1542
|
+
Yn as LEFT,
|
|
1543
|
+
Bn as RIGHT,
|
|
1544
|
+
Wn as SIDE,
|
|
1545
|
+
nt as THEME,
|
|
1546
|
+
$ as default
|
|
1536
1547
|
};
|