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