mind-elixir 5.9.3 → 5.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +610 -753
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +232 -236
- package/dist/PlaintextConverter.js +125 -119
- package/dist/i18n.js +242 -0
- package/dist/types/docs.d.ts +2 -2
- package/dist/types/i18n.d.ts +19 -7
- package/dist/types/index.d.ts +2 -4
- package/dist/types/interact.d.ts +0 -8
- package/dist/types/methods.d.ts +0 -1
- package/dist/types/plugin/contextMenu.d.ts +2 -0
- package/dist/types/types/index.d.ts +13 -2
- package/package.json +8 -15
- package/readme.md +2 -2
package/dist/MindElixir.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const qo = 0, Uo = 1, Jo = 2, ve = {
|
|
2
2
|
name: "Latte",
|
|
3
3
|
type: "light",
|
|
4
4
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -67,10 +67,10 @@ const le = function(e, t) {
|
|
|
67
67
|
return null;
|
|
68
68
|
} else
|
|
69
69
|
return null;
|
|
70
|
-
},
|
|
70
|
+
}, V = (e, t) => {
|
|
71
71
|
if (e.parent = t, e.children)
|
|
72
72
|
for (let n = 0; n < e.children.length; n++)
|
|
73
|
-
|
|
73
|
+
V(e.children[n], e);
|
|
74
74
|
}, U = (e, t, n) => {
|
|
75
75
|
if (e.expanded = t, e.children)
|
|
76
76
|
if (n === void 0 || n > 0) {
|
|
@@ -84,7 +84,7 @@ const le = function(e, t) {
|
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
86
|
function xe(e) {
|
|
87
|
-
if (e.id =
|
|
87
|
+
if (e.id = z(), e.children)
|
|
88
88
|
for (let t = 0; t < e.children.length; t++)
|
|
89
89
|
xe(e.children[t]);
|
|
90
90
|
}
|
|
@@ -97,17 +97,17 @@ function ce(e, t, n, o) {
|
|
|
97
97
|
y2: o + Math.sin(h) * r
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function z() {
|
|
101
101
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substring(2)).substring(2, 18);
|
|
102
102
|
}
|
|
103
|
-
const
|
|
104
|
-
const e =
|
|
103
|
+
const ut = function() {
|
|
104
|
+
const e = z();
|
|
105
105
|
return {
|
|
106
106
|
topic: this.newTopicName,
|
|
107
107
|
id: e
|
|
108
108
|
};
|
|
109
109
|
};
|
|
110
|
-
function
|
|
110
|
+
function Ee(e) {
|
|
111
111
|
return JSON.parse(
|
|
112
112
|
JSON.stringify(e, (n, o) => {
|
|
113
113
|
if (n !== "parent")
|
|
@@ -115,15 +115,15 @@ function Ce(e) {
|
|
|
115
115
|
})
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
|
-
const
|
|
118
|
+
const H = (e, t) => {
|
|
119
119
|
let n = 0, o = 0;
|
|
120
120
|
for (; t && t !== e; )
|
|
121
121
|
n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
|
|
122
122
|
return { offsetLeft: n, offsetTop: o };
|
|
123
|
-
},
|
|
123
|
+
}, D = (e, t) => {
|
|
124
124
|
for (const n in t)
|
|
125
125
|
e.setAttribute(n, t[n]);
|
|
126
|
-
}, re = (e) => e ? e.tagName === "ME-TPC" : !1,
|
|
126
|
+
}, re = (e) => e ? e.tagName === "ME-TPC" : !1, Ce = (e) => e.filter((t) => t.nodeObj.parent).filter((t, n, o) => {
|
|
127
127
|
for (let s = 0; s < o.length; s++) {
|
|
128
128
|
if (t === o[s]) continue;
|
|
129
129
|
const { parent: i } = t.nodeObj;
|
|
@@ -134,7 +134,7 @@ const j = (e, t) => {
|
|
|
134
134
|
}), Se = (e) => {
|
|
135
135
|
const t = /translate3d\(([^,]+),\s*([^,]+)/, n = e.match(t);
|
|
136
136
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
137
|
-
},
|
|
137
|
+
}, Je = function(e) {
|
|
138
138
|
for (let t = 0; t < e.length; t++) {
|
|
139
139
|
const { dom: n, evt: o, func: s } = e[t];
|
|
140
140
|
n.addEventListener(o, s);
|
|
@@ -151,7 +151,7 @@ const j = (e, t) => {
|
|
|
151
151
|
}, B = {
|
|
152
152
|
LHS: "lhs",
|
|
153
153
|
RHS: "rhs"
|
|
154
|
-
},
|
|
154
|
+
}, pt = function() {
|
|
155
155
|
this.nodes.innerHTML = "";
|
|
156
156
|
const e = this.createTopic(this.nodeData);
|
|
157
157
|
Ne.call(this, e, this.nodeData), e.draggable = !1;
|
|
@@ -164,8 +164,8 @@ const j = (e, t) => {
|
|
|
164
164
|
i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
|
-
|
|
168
|
-
},
|
|
167
|
+
gt(this, n, t);
|
|
168
|
+
}, gt = function(e, t, n) {
|
|
169
169
|
const o = document.createElement("me-main");
|
|
170
170
|
o.className = B.LHS;
|
|
171
171
|
const s = document.createElement("me-main");
|
|
@@ -175,14 +175,14 @@ const j = (e, t) => {
|
|
|
175
175
|
e.direction === 2 ? l.direction === 0 ? o.appendChild(c) : s.appendChild(c) : e.direction === 0 ? o.appendChild(c) : s.appendChild(c);
|
|
176
176
|
}
|
|
177
177
|
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines), e.nodes.appendChild(e.labelContainer);
|
|
178
|
-
},
|
|
178
|
+
}, mt = function(e, t) {
|
|
179
179
|
const n = document.createElement("me-children");
|
|
180
180
|
for (let o = 0; o < t.length; o++) {
|
|
181
181
|
const s = t[o], { grp: i } = e.createWrapper(s);
|
|
182
182
|
n.appendChild(i);
|
|
183
183
|
}
|
|
184
184
|
return n;
|
|
185
|
-
},
|
|
185
|
+
}, Ze = function(e, t) {
|
|
186
186
|
const o = (this?.el ? this.el : t || document).querySelector(`[data-nodeid="me${e}"]`);
|
|
187
187
|
if (!o) throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
188
188
|
return o;
|
|
@@ -222,35 +222,35 @@ const j = (e, t) => {
|
|
|
222
222
|
typeof o == "string" ? s.textContent = o : (s.textContent = o.text, o.className && (s.className = o.className), o.style && Object.assign(s.style, o.style)), n.appendChild(s);
|
|
223
223
|
}), e.appendChild(n), e.tags = n;
|
|
224
224
|
} else e.tags && (e.tags = void 0);
|
|
225
|
-
},
|
|
225
|
+
}, yt = function(e, t) {
|
|
226
226
|
const n = document.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
|
|
227
227
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
228
|
-
const i =
|
|
228
|
+
const i = Te(e.expanded);
|
|
229
229
|
if (o.appendChild(i), e.expanded !== !1) {
|
|
230
|
-
const l =
|
|
230
|
+
const l = mt(this, e.children);
|
|
231
231
|
n.appendChild(l);
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
return { grp: n, top: o, tpc: s };
|
|
235
|
-
},
|
|
235
|
+
}, bt = function(e) {
|
|
236
236
|
const t = document.createElement("me-parent"), n = this.createTopic(e);
|
|
237
237
|
return Ne.call(this, n, e), t.appendChild(n), { p: t, tpc: n };
|
|
238
|
-
},
|
|
238
|
+
}, vt = function(e) {
|
|
239
239
|
const t = document.createElement("me-children");
|
|
240
240
|
return t.append(...e), t;
|
|
241
|
-
},
|
|
241
|
+
}, wt = function(e) {
|
|
242
242
|
const t = document.createElement("me-tpc");
|
|
243
243
|
return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t;
|
|
244
244
|
};
|
|
245
|
-
function
|
|
245
|
+
function Qe(e) {
|
|
246
246
|
const t = document.createRange();
|
|
247
247
|
t.selectNodeContents(e);
|
|
248
248
|
const n = window.getSelection();
|
|
249
249
|
n && (n.removeAllRanges(), n.addRange(t));
|
|
250
250
|
}
|
|
251
|
-
const
|
|
251
|
+
const xt = function(e) {
|
|
252
252
|
if (!e) return;
|
|
253
|
-
const t = document.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } =
|
|
253
|
+
const t = document.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = H(this.nodes, e);
|
|
254
254
|
this.nodes.appendChild(t), t.id = "input-box", t.textContent = o, t.contentEditable = "plaintext-only", t.spellcheck = !1;
|
|
255
255
|
const l = getComputedStyle(e);
|
|
256
256
|
t.style.cssText = `
|
|
@@ -263,7 +263,7 @@ const Et = function(e) {
|
|
|
263
263
|
margin:${l.margin};
|
|
264
264
|
background-color:${l.backgroundColor !== "rgba(0, 0, 0, 0)" && l.backgroundColor};
|
|
265
265
|
border: ${l.border};
|
|
266
|
-
border-radius:${l.borderRadius}; `, this.direction === 0 && (t.style.right = "0"),
|
|
266
|
+
border-radius:${l.borderRadius}; `, this.direction === 0 && (t.style.right = "0"), Qe(t), this.bus.fire("operation", {
|
|
267
267
|
name: "beginEdit",
|
|
268
268
|
obj: e.nodeObj
|
|
269
269
|
}), t.addEventListener("keydown", (c) => {
|
|
@@ -283,39 +283,39 @@ const Et = function(e) {
|
|
|
283
283
|
origin: o
|
|
284
284
|
}));
|
|
285
285
|
});
|
|
286
|
-
},
|
|
286
|
+
}, Te = function(e) {
|
|
287
287
|
const t = document.createElement("me-epd");
|
|
288
288
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
289
289
|
}, J = (e) => {
|
|
290
290
|
const t = e.parent?.children, n = t?.indexOf(e) ?? 0;
|
|
291
291
|
return { siblings: t, index: n };
|
|
292
292
|
};
|
|
293
|
-
function
|
|
293
|
+
function Et(e) {
|
|
294
294
|
const { siblings: t, index: n } = J(e);
|
|
295
295
|
if (t === void 0) return;
|
|
296
296
|
const o = t[n];
|
|
297
297
|
n === 0 ? (t[n] = t[t.length - 1], t[t.length - 1] = o) : (t[n] = t[n - 1], t[n - 1] = o);
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function Ct(e) {
|
|
300
300
|
const { siblings: t, index: n } = J(e);
|
|
301
301
|
if (t === void 0) return;
|
|
302
302
|
const o = t[n];
|
|
303
303
|
n === t.length - 1 ? (t[n] = t[0], t[0] = o) : (t[n] = t[n + 1], t[n + 1] = o);
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function et(e) {
|
|
306
306
|
const { siblings: t, index: n } = J(e);
|
|
307
307
|
return t === void 0 ? 0 : (t.splice(n, 1), t.length);
|
|
308
308
|
}
|
|
309
|
-
function
|
|
309
|
+
function St(e, t, n) {
|
|
310
310
|
const { siblings: o, index: s } = J(n);
|
|
311
311
|
o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function Nt(e, t) {
|
|
314
314
|
const { siblings: n, index: o } = J(e);
|
|
315
315
|
n !== void 0 && (n[o] = t, t.children = [e]);
|
|
316
316
|
}
|
|
317
|
-
function
|
|
318
|
-
if (
|
|
317
|
+
function Tt(e, t, n) {
|
|
318
|
+
if (et(t), n.parent?.parent || (t.direction = n.direction), e === "in")
|
|
319
319
|
n.children ? n.children.push(t) : n.children = [t];
|
|
320
320
|
else {
|
|
321
321
|
t.direction !== void 0 && (t.direction = n.direction);
|
|
@@ -324,7 +324,7 @@ function _t(e, t, n) {
|
|
|
324
324
|
e === "before" ? o.splice(s, 0, t) : o.splice(s + 1, 0, t);
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
|
-
const
|
|
327
|
+
const _t = function({ map: e, direction: t }, n) {
|
|
328
328
|
if (t === 0)
|
|
329
329
|
return 0;
|
|
330
330
|
if (t === 1)
|
|
@@ -333,32 +333,32 @@ const Lt = function({ map: e, direction: t }, n) {
|
|
|
333
333
|
const o = e.querySelector(".lhs")?.childElementCount || 0, s = e.querySelector(".rhs")?.childElementCount || 0;
|
|
334
334
|
return o <= s ? (n.direction = 0, 0) : (n.direction = 1, 1);
|
|
335
335
|
}
|
|
336
|
-
},
|
|
336
|
+
}, tt = function(e, t, n) {
|
|
337
337
|
const o = n.children[0].children[0], s = t.parentElement;
|
|
338
338
|
if (s.tagName === "ME-PARENT") {
|
|
339
339
|
if (ee(o), s.children[1])
|
|
340
340
|
s.nextSibling.appendChild(n);
|
|
341
341
|
else {
|
|
342
342
|
const i = e.createChildren([n]);
|
|
343
|
-
s.appendChild(
|
|
343
|
+
s.appendChild(Te(!0)), s.insertAdjacentElement("afterend", i);
|
|
344
344
|
}
|
|
345
345
|
e.linkDiv(n.offsetParent);
|
|
346
|
-
} else s.tagName === "ME-ROOT" && (
|
|
347
|
-
},
|
|
346
|
+
} else s.tagName === "ME-ROOT" && (_t(e, o.nodeObj) === 0 ? e.container.querySelector(".lhs")?.appendChild(n) : e.container.querySelector(".rhs")?.appendChild(n), e.linkDiv());
|
|
347
|
+
}, kt = function(e, t) {
|
|
348
348
|
const n = e.parentNode;
|
|
349
349
|
if (t === 0) {
|
|
350
350
|
const o = n.parentNode.parentNode;
|
|
351
351
|
o.tagName !== "ME-MAIN" && (o.previousSibling.children[1].remove(), o.remove());
|
|
352
352
|
}
|
|
353
353
|
n.parentNode.remove();
|
|
354
|
-
},
|
|
354
|
+
}, nt = {
|
|
355
355
|
before: "beforebegin",
|
|
356
356
|
after: "afterend"
|
|
357
357
|
}, ee = function(e) {
|
|
358
358
|
const n = e.parentElement.parentElement.lastElementChild;
|
|
359
359
|
n?.tagName === "svg" && n?.remove();
|
|
360
|
-
},
|
|
361
|
-
const n = e.nodeObj, o =
|
|
360
|
+
}, Lt = function(e, t) {
|
|
361
|
+
const n = e.nodeObj, o = Ee(n);
|
|
362
362
|
o.style && t.style && (t.style = Object.assign(o.style, t.style));
|
|
363
363
|
const s = Object.assign(n, t);
|
|
364
364
|
Ne.call(this, e, s), this.linkDiv(), this.bus.fire("operation", {
|
|
@@ -366,15 +366,15 @@ const Lt = function({ map: e, direction: t }, n) {
|
|
|
366
366
|
obj: s,
|
|
367
367
|
origin: o
|
|
368
368
|
});
|
|
369
|
-
},
|
|
369
|
+
}, _e = function(e, t, n) {
|
|
370
370
|
if (!t) return null;
|
|
371
371
|
const o = t.nodeObj;
|
|
372
372
|
o.expanded === !1 && (e.expandNode(t, !0), t = e.findEle(o.id));
|
|
373
373
|
const s = n || e.generateNewObj();
|
|
374
|
-
o.children ? o.children.push(s) : o.children = [s],
|
|
374
|
+
o.children ? o.children.push(s) : o.children = [s], V(e.nodeData);
|
|
375
375
|
const { grp: i, top: l } = e.createWrapper(s);
|
|
376
|
-
return
|
|
377
|
-
},
|
|
376
|
+
return tt(e, t, i), { newTop: l, newNodeObj: s };
|
|
377
|
+
}, Dt = function(e, t, n) {
|
|
378
378
|
const o = t || this.currentNode;
|
|
379
379
|
if (!o) return;
|
|
380
380
|
const s = o.nodeObj;
|
|
@@ -395,14 +395,14 @@ const Lt = function({ map: e, direction: t }, n) {
|
|
|
395
395
|
const a = o.closest("me-main").className === B.LHS ? 0 : 1;
|
|
396
396
|
i.direction = a;
|
|
397
397
|
}
|
|
398
|
-
|
|
398
|
+
St(i, e, s), V(this.nodeData);
|
|
399
399
|
const l = o.parentElement, { grp: c, top: r } = this.createWrapper(i);
|
|
400
|
-
l.parentElement.insertAdjacentElement(
|
|
400
|
+
l.parentElement.insertAdjacentElement(nt[e], c), this.linkDiv(c.offsetParent), n || this.editTopic(r.firstChild), this.bus.fire("operation", {
|
|
401
401
|
name: "insertSibling",
|
|
402
402
|
type: e,
|
|
403
403
|
obj: i
|
|
404
404
|
}), this.selectNode(r.firstChild, !0);
|
|
405
|
-
},
|
|
405
|
+
}, At = function(e, t) {
|
|
406
406
|
const n = e || this.currentNode;
|
|
407
407
|
if (!n) return;
|
|
408
408
|
ee(n);
|
|
@@ -410,40 +410,40 @@ const Lt = function({ map: e, direction: t }, n) {
|
|
|
410
410
|
if (!o.parent)
|
|
411
411
|
return;
|
|
412
412
|
const s = t || this.generateNewObj();
|
|
413
|
-
|
|
413
|
+
Nt(o, s), V(this.nodeData);
|
|
414
414
|
const i = n.parentElement.parentElement, { grp: l, top: c } = this.createWrapper(s, !0);
|
|
415
|
-
c.appendChild(
|
|
415
|
+
c.appendChild(Te(!0)), i.insertAdjacentElement("afterend", l);
|
|
416
416
|
const r = this.createChildren([i]);
|
|
417
417
|
c.insertAdjacentElement("afterend", r), this.linkDiv(), t || this.editTopic(c.firstChild), this.selectNode(c.firstChild, !0), this.bus.fire("operation", {
|
|
418
418
|
name: "insertParent",
|
|
419
419
|
obj: s
|
|
420
420
|
});
|
|
421
|
-
},
|
|
421
|
+
}, Mt = function(e, t) {
|
|
422
422
|
const n = e || this.currentNode;
|
|
423
423
|
if (!n) return;
|
|
424
|
-
const o =
|
|
424
|
+
const o = _e(this, n, t);
|
|
425
425
|
if (!o) return;
|
|
426
426
|
const { newTop: s, newNodeObj: i } = o;
|
|
427
427
|
this.bus.fire("operation", {
|
|
428
428
|
name: "addChild",
|
|
429
429
|
obj: i
|
|
430
430
|
}), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
|
|
431
|
-
},
|
|
432
|
-
const n =
|
|
431
|
+
}, Pt = function(e, t) {
|
|
432
|
+
const n = Ee(e.nodeObj);
|
|
433
433
|
xe(n);
|
|
434
|
-
const o =
|
|
434
|
+
const o = _e(this, t, n);
|
|
435
435
|
if (!o) return;
|
|
436
436
|
const { newNodeObj: s } = o;
|
|
437
437
|
this.selectNode(this.findEle(s.id)), this.bus.fire("operation", {
|
|
438
438
|
name: "copyNode",
|
|
439
439
|
obj: s
|
|
440
440
|
});
|
|
441
|
-
},
|
|
441
|
+
}, Ot = function(e, t) {
|
|
442
442
|
const n = [];
|
|
443
443
|
for (let o = 0; o < e.length; o++) {
|
|
444
|
-
const s = e[o], i =
|
|
444
|
+
const s = e[o], i = Ee(s.nodeObj);
|
|
445
445
|
xe(i);
|
|
446
|
-
const l =
|
|
446
|
+
const l = _e(this, t, i);
|
|
447
447
|
if (!l) return;
|
|
448
448
|
const { newNodeObj: c } = l;
|
|
449
449
|
n.push(c);
|
|
@@ -452,51 +452,51 @@ const Lt = function({ map: e, direction: t }, n) {
|
|
|
452
452
|
name: "copyNodes",
|
|
453
453
|
objs: n
|
|
454
454
|
});
|
|
455
|
-
},
|
|
455
|
+
}, $t = function(e) {
|
|
456
456
|
const t = e || this.currentNode;
|
|
457
457
|
if (!t) return;
|
|
458
458
|
const n = t.nodeObj;
|
|
459
|
-
|
|
459
|
+
Et(n);
|
|
460
460
|
const o = t.parentNode.parentNode;
|
|
461
461
|
o.parentNode.insertBefore(o, o.previousSibling), this.linkDiv(), this.bus.fire("operation", {
|
|
462
462
|
name: "moveUpNode",
|
|
463
463
|
obj: n
|
|
464
464
|
});
|
|
465
|
-
},
|
|
465
|
+
}, Ht = function(e) {
|
|
466
466
|
const t = e || this.currentNode;
|
|
467
467
|
if (!t) return;
|
|
468
468
|
const n = t.nodeObj;
|
|
469
|
-
|
|
469
|
+
Ct(n);
|
|
470
470
|
const o = t.parentNode.parentNode;
|
|
471
471
|
o.nextSibling ? o.nextSibling.insertAdjacentElement("afterend", o) : o.parentNode.prepend(o), this.linkDiv(), this.bus.fire("operation", {
|
|
472
472
|
name: "moveDownNode",
|
|
473
473
|
obj: n
|
|
474
474
|
});
|
|
475
|
-
},
|
|
476
|
-
if (e =
|
|
475
|
+
}, jt = function(e) {
|
|
476
|
+
if (e = Ce(e), e.length === 0) return;
|
|
477
477
|
for (const n of e) {
|
|
478
|
-
const o = n.nodeObj, s =
|
|
479
|
-
|
|
478
|
+
const o = n.nodeObj, s = et(o);
|
|
479
|
+
kt(n, s);
|
|
480
480
|
}
|
|
481
481
|
const t = e[e.length - 1];
|
|
482
482
|
this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
|
|
483
483
|
name: "removeNodes",
|
|
484
484
|
objs: e.map((n) => n.nodeObj)
|
|
485
485
|
});
|
|
486
|
-
},
|
|
487
|
-
e =
|
|
486
|
+
}, ke = (e, t, n, o) => {
|
|
487
|
+
e = Ce(e);
|
|
488
488
|
let s = n.nodeObj;
|
|
489
489
|
t === "in" && s.expanded === !1 && (o.expandNode(n, !0), n = o.findEle(s.id), s = n.nodeObj), t === "after" && (e = e.reverse());
|
|
490
490
|
const i = [];
|
|
491
491
|
for (const c of e) {
|
|
492
492
|
const r = c.nodeObj;
|
|
493
|
-
if (
|
|
493
|
+
if (Tt(t, r, s), V(o.nodeData), t === "in") {
|
|
494
494
|
const a = c.parentElement;
|
|
495
|
-
|
|
495
|
+
tt(o, n, a.parentElement);
|
|
496
496
|
} else {
|
|
497
497
|
ee(c);
|
|
498
498
|
const a = c.parentElement.parentNode;
|
|
499
|
-
i.includes(a.parentElement) || i.push(a.parentElement), n.parentElement.parentNode.insertAdjacentElement(
|
|
499
|
+
i.includes(a.parentElement) || i.push(a.parentElement), n.parentElement.parentNode.insertAdjacentElement(nt[t], a);
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
for (const c of i)
|
|
@@ -508,36 +508,36 @@ const Lt = function({ map: e, direction: t }, n) {
|
|
|
508
508
|
objs: e.map((c) => c.nodeObj),
|
|
509
509
|
toObj: s
|
|
510
510
|
});
|
|
511
|
+
}, It = function(e, t) {
|
|
512
|
+
ke(e, "in", t, this);
|
|
513
|
+
}, Rt = function(e, t) {
|
|
514
|
+
ke(e, "before", t, this);
|
|
511
515
|
}, Bt = function(e, t) {
|
|
512
|
-
|
|
513
|
-
},
|
|
514
|
-
_e(e, "before", t, this);
|
|
515
|
-
}, Yt = function(e, t) {
|
|
516
|
-
_e(e, "after", t, this);
|
|
517
|
-
}, Wt = function(e) {
|
|
516
|
+
ke(e, "after", t, this);
|
|
517
|
+
}, Yt = function(e) {
|
|
518
518
|
const t = e || this.currentNode;
|
|
519
519
|
t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t));
|
|
520
|
-
},
|
|
520
|
+
}, Wt = function(e, t) {
|
|
521
521
|
e.text.textContent = t, e.nodeObj.topic = t, this.linkDiv();
|
|
522
|
-
},
|
|
522
|
+
}, ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
523
523
|
__proto__: null,
|
|
524
|
-
addChild:
|
|
525
|
-
beginEdit:
|
|
526
|
-
copyNode:
|
|
527
|
-
copyNodes:
|
|
528
|
-
insertParent:
|
|
529
|
-
insertSibling:
|
|
530
|
-
moveDownNode:
|
|
531
|
-
moveNodeAfter:
|
|
532
|
-
moveNodeBefore:
|
|
533
|
-
moveNodeIn:
|
|
534
|
-
moveUpNode:
|
|
535
|
-
removeNodes:
|
|
536
|
-
reshapeNode:
|
|
524
|
+
addChild: Mt,
|
|
525
|
+
beginEdit: Yt,
|
|
526
|
+
copyNode: Pt,
|
|
527
|
+
copyNodes: Ot,
|
|
528
|
+
insertParent: At,
|
|
529
|
+
insertSibling: Dt,
|
|
530
|
+
moveDownNode: Ht,
|
|
531
|
+
moveNodeAfter: Bt,
|
|
532
|
+
moveNodeBefore: Rt,
|
|
533
|
+
moveNodeIn: It,
|
|
534
|
+
moveUpNode: $t,
|
|
535
|
+
removeNodes: jt,
|
|
536
|
+
reshapeNode: Lt,
|
|
537
537
|
rmSubline: ee,
|
|
538
|
-
setNodeTopic:
|
|
538
|
+
setNodeTopic: Wt
|
|
539
539
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
540
|
-
function
|
|
540
|
+
function Xt(e) {
|
|
541
541
|
return {
|
|
542
542
|
nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
|
|
543
543
|
arrows: e.arrows,
|
|
@@ -546,62 +546,62 @@ function zt(e) {
|
|
|
546
546
|
theme: e.theme
|
|
547
547
|
};
|
|
548
548
|
}
|
|
549
|
-
const
|
|
549
|
+
const Ft = function(e) {
|
|
550
550
|
const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
|
|
551
551
|
if (n.top > o.bottom - 50 || n.bottom < o.top + 50 || n.left > o.right - 50 || n.right < o.left + 50) {
|
|
552
552
|
const i = n.left + n.width / 2, l = n.top + n.height / 2, c = o.left + o.width / 2, r = o.top + o.height / 2, a = i - c, d = l - r;
|
|
553
553
|
this.move(-a, -d, !0);
|
|
554
554
|
}
|
|
555
|
-
},
|
|
555
|
+
}, Gt = function(e, t, n) {
|
|
556
556
|
this.clearSelection(), this.scrollIntoView(e), this.selection?.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
|
|
557
|
-
},
|
|
557
|
+
}, Vt = function(e) {
|
|
558
558
|
this.selection?.select(e);
|
|
559
|
-
},
|
|
559
|
+
}, zt = function(e) {
|
|
560
560
|
this.selection?.deselect(e);
|
|
561
|
-
},
|
|
561
|
+
}, Kt = function() {
|
|
562
562
|
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
563
563
|
}, Le = function(e) {
|
|
564
564
|
return JSON.stringify(e, (t, n) => {
|
|
565
565
|
if (!(t === "parent" && typeof n != "string"))
|
|
566
566
|
return n;
|
|
567
567
|
});
|
|
568
|
-
},
|
|
569
|
-
const e =
|
|
568
|
+
}, qt = function() {
|
|
569
|
+
const e = Xt(this);
|
|
570
570
|
return Le(e);
|
|
571
|
-
},
|
|
571
|
+
}, Ut = function() {
|
|
572
572
|
return JSON.parse(this.getDataString());
|
|
573
|
-
},
|
|
573
|
+
}, Jt = function() {
|
|
574
574
|
this.editable = !0;
|
|
575
|
-
},
|
|
575
|
+
}, Zt = function() {
|
|
576
576
|
this.editable = !1;
|
|
577
|
-
},
|
|
577
|
+
}, Qt = function(e, t = { x: 0, y: 0 }) {
|
|
578
578
|
if (e < this.scaleMin && e < this.scaleVal || e > this.scaleMax && e > this.scaleVal) return;
|
|
579
|
-
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } =
|
|
580
|
-
this.map.style.transform = `translate3d(${r - y}px, ${a -
|
|
581
|
-
},
|
|
579
|
+
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } = De(this), c = this.map.style.transform, { x: r, y: a } = Se(c), d = r - i, h = a - l, u = this.scaleVal, y = (-o + d) * (1 - e / u), b = (-s + h) * (1 - e / u);
|
|
580
|
+
this.map.style.transform = `translate3d(${r - y}px, ${a - b}px, 0) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
|
|
581
|
+
}, en = function() {
|
|
582
582
|
const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
|
|
583
583
|
this.scaleVal = n;
|
|
584
|
-
const { dx: o, dy: s } =
|
|
584
|
+
const { dx: o, dy: s } = De(this, !0);
|
|
585
585
|
this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n);
|
|
586
|
-
},
|
|
586
|
+
}, tn = function(e, t, n = !1) {
|
|
587
587
|
const { map: o, scaleVal: s, bus: i, container: l, nodes: c } = this;
|
|
588
588
|
if (n && o.style.transition === "transform 0.3s")
|
|
589
589
|
return;
|
|
590
590
|
const r = o.style.transform;
|
|
591
591
|
let { x: a, y: d } = Se(r);
|
|
592
|
-
const h = l.getBoundingClientRect(), u = c.getBoundingClientRect(), y = u.left < h.right && u.right > h.left,
|
|
592
|
+
const h = l.getBoundingClientRect(), u = c.getBoundingClientRect(), y = u.left < h.right && u.right > h.left, b = u.top < h.bottom && u.bottom > h.top;
|
|
593
593
|
if (y) {
|
|
594
594
|
const p = u.left + e, g = u.right + e;
|
|
595
595
|
(p >= h.right || g <= h.left) && (e = 0);
|
|
596
596
|
}
|
|
597
|
-
if (
|
|
597
|
+
if (b) {
|
|
598
598
|
const p = u.top + t, g = u.bottom + t;
|
|
599
599
|
(p >= h.bottom || g <= h.top) && (t = 0);
|
|
600
600
|
}
|
|
601
601
|
a += e, d += t, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
602
602
|
o.style.transition = "none";
|
|
603
603
|
}, 300)), o.style.transform = `translate3d(${a}px, ${d}px, 0) scale(${s})`, i.fire("move", { dx: e, dy: t });
|
|
604
|
-
},
|
|
604
|
+
}, De = (e, t = !1) => {
|
|
605
605
|
const { container: n, map: o, nodes: s } = e;
|
|
606
606
|
let i, l;
|
|
607
607
|
if (e.alignment === "nodes" || t)
|
|
@@ -611,24 +611,22 @@ const Gt = function(e) {
|
|
|
611
611
|
i = n.offsetWidth / 2 - a - d / 2, l = n.offsetHeight / 2 - r - h / 2, o.style.transformOrigin = `${a + d / 2}px 50%`;
|
|
612
612
|
}
|
|
613
613
|
return { dx: i, dy: l };
|
|
614
|
-
},
|
|
615
|
-
const { map: e, container: t } = this, { dx: n, dy: o } =
|
|
614
|
+
}, nn = function() {
|
|
615
|
+
const { map: e, container: t } = this, { dx: n, dy: o } = De(this);
|
|
616
616
|
t.scrollTop = 0, t.scrollLeft = 0, e.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
|
|
617
|
-
},
|
|
617
|
+
}, on = function(e) {
|
|
618
618
|
e(this);
|
|
619
|
-
},
|
|
619
|
+
}, sn = function(e) {
|
|
620
620
|
e.nodeObj.parent && (this.clearSelection(), this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = e.nodeObj, this.initRight(), this.toCenter());
|
|
621
|
-
},
|
|
621
|
+
}, rn = function() {
|
|
622
622
|
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
623
|
-
},
|
|
623
|
+
}, ln = function() {
|
|
624
624
|
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
625
|
-
},
|
|
625
|
+
}, cn = function() {
|
|
626
626
|
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
627
|
-
},
|
|
627
|
+
}, an = function() {
|
|
628
628
|
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
629
|
-
},
|
|
630
|
-
this.locale = e, this.refresh();
|
|
631
|
-
}, un = function(e, t) {
|
|
629
|
+
}, dn = function(e, t) {
|
|
632
630
|
const n = e.nodeObj;
|
|
633
631
|
typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
634
632
|
const o = e.getBoundingClientRect(), s = {
|
|
@@ -648,7 +646,7 @@ const Gt = function(e) {
|
|
|
648
646
|
y: c.top
|
|
649
647
|
}, a = s.x - r.x, d = s.y - r.y;
|
|
650
648
|
this.move(a, d), this.bus.fire("expandNode", n);
|
|
651
|
-
},
|
|
649
|
+
}, hn = function(e, t) {
|
|
652
650
|
const n = e.nodeObj, o = e.getBoundingClientRect(), s = {
|
|
653
651
|
x: o.left,
|
|
654
652
|
y: o.top
|
|
@@ -659,46 +657,45 @@ const Gt = function(e) {
|
|
|
659
657
|
y: i.top
|
|
660
658
|
}, c = s.x - l.x, r = s.y - l.y;
|
|
661
659
|
this.move(c, r);
|
|
662
|
-
},
|
|
663
|
-
this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)),
|
|
664
|
-
},
|
|
660
|
+
}, fn = function(e) {
|
|
661
|
+
this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)), V(this.nodeData), this.layout(), this.linkDiv();
|
|
662
|
+
}, un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
665
663
|
__proto__: null,
|
|
666
|
-
cancelFocus:
|
|
667
|
-
clearSelection:
|
|
668
|
-
disableEdit:
|
|
669
|
-
enableEdit:
|
|
670
|
-
expandNode:
|
|
671
|
-
expandNodeAll:
|
|
672
|
-
focusNode:
|
|
673
|
-
getData:
|
|
674
|
-
getDataString:
|
|
675
|
-
initLeft:
|
|
676
|
-
initRight:
|
|
677
|
-
initSide:
|
|
678
|
-
install:
|
|
679
|
-
move:
|
|
680
|
-
refresh:
|
|
681
|
-
scale:
|
|
682
|
-
scaleFit:
|
|
683
|
-
scrollIntoView:
|
|
684
|
-
selectNode:
|
|
685
|
-
selectNodes:
|
|
686
|
-
setLocale: fn,
|
|
664
|
+
cancelFocus: rn,
|
|
665
|
+
clearSelection: Kt,
|
|
666
|
+
disableEdit: Zt,
|
|
667
|
+
enableEdit: Jt,
|
|
668
|
+
expandNode: dn,
|
|
669
|
+
expandNodeAll: hn,
|
|
670
|
+
focusNode: sn,
|
|
671
|
+
getData: Ut,
|
|
672
|
+
getDataString: qt,
|
|
673
|
+
initLeft: ln,
|
|
674
|
+
initRight: cn,
|
|
675
|
+
initSide: an,
|
|
676
|
+
install: on,
|
|
677
|
+
move: tn,
|
|
678
|
+
refresh: fn,
|
|
679
|
+
scale: Qt,
|
|
680
|
+
scaleFit: en,
|
|
681
|
+
scrollIntoView: Ft,
|
|
682
|
+
selectNode: Gt,
|
|
683
|
+
selectNodes: Vt,
|
|
687
684
|
stringifyData: Le,
|
|
688
|
-
toCenter:
|
|
689
|
-
unselectNodes:
|
|
690
|
-
}, Symbol.toStringTag, { value: "Module" })), Oe = "MIND-ELIXIR-WAIT-COPY",
|
|
685
|
+
toCenter: nn,
|
|
686
|
+
unselectNodes: zt
|
|
687
|
+
}, Symbol.toStringTag, { value: "Module" })), Oe = "MIND-ELIXIR-WAIT-COPY", pn = (e, t) => {
|
|
691
688
|
const n = e.map.querySelectorAll(`.${t}>me-wrapper>me-parent>me-tpc`);
|
|
692
689
|
n.length !== 0 && e.selectNode(n[Math.ceil(n.length / 2) - 1]);
|
|
693
|
-
},
|
|
690
|
+
}, gn = (e) => {
|
|
694
691
|
e.selectNode(e.map.querySelector("me-root>me-tpc"));
|
|
695
|
-
},
|
|
692
|
+
}, mn = function(e, t) {
|
|
696
693
|
const n = t.parentElement.parentElement.parentElement.previousSibling;
|
|
697
694
|
if (n) {
|
|
698
695
|
const o = n.firstChild;
|
|
699
696
|
e.selectNode(o);
|
|
700
697
|
}
|
|
701
|
-
},
|
|
698
|
+
}, yn = function(e, t) {
|
|
702
699
|
const n = t.parentElement.nextSibling;
|
|
703
700
|
if (n && n.firstChild) {
|
|
704
701
|
const o = n.firstChild.firstChild.firstChild;
|
|
@@ -708,8 +705,8 @@ const Gt = function(e) {
|
|
|
708
705
|
const n = e.currentNode || e.currentNodes?.[0];
|
|
709
706
|
if (!n) return;
|
|
710
707
|
const o = n.nodeObj, s = n.offsetParent.offsetParent.parentElement;
|
|
711
|
-
o.parent ? s.className === t ?
|
|
712
|
-
},
|
|
708
|
+
o.parent ? s.className === t ? yn(e, n) : o.parent?.parent ? mn(e, n) : gn(e) : pn(e, t);
|
|
709
|
+
}, He = function(e, t) {
|
|
713
710
|
const n = e.currentNode;
|
|
714
711
|
if (!n || !n.nodeObj.parent) return;
|
|
715
712
|
const s = t + "Sibling", i = n.parentElement.parentElement[s];
|
|
@@ -724,7 +721,7 @@ const Gt = function(e) {
|
|
|
724
721
|
e.scale(o - s, n);
|
|
725
722
|
}
|
|
726
723
|
};
|
|
727
|
-
function
|
|
724
|
+
function bn(e, t) {
|
|
728
725
|
t = t === !0 ? {} : t;
|
|
729
726
|
const n = () => {
|
|
730
727
|
e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNodes && e.removeNodes(e.currentNodes);
|
|
@@ -761,11 +758,11 @@ function xn(e, t) {
|
|
|
761
758
|
else {
|
|
762
759
|
if (r.metaKey || r.ctrlKey)
|
|
763
760
|
return e.initSide();
|
|
764
|
-
|
|
761
|
+
He(e, "previous");
|
|
765
762
|
}
|
|
766
763
|
},
|
|
767
764
|
ArrowDown: (r) => {
|
|
768
|
-
r.altKey ? e.moveDownNode() :
|
|
765
|
+
r.altKey ? e.moveDownNode() : He(e, "next");
|
|
769
766
|
},
|
|
770
767
|
ArrowLeft: (r) => {
|
|
771
768
|
if (r.metaKey || r.ctrlKey)
|
|
@@ -811,7 +808,7 @@ function xn(e, t) {
|
|
|
811
808
|
const c = (r) => {
|
|
812
809
|
if (r.target instanceof HTMLElement && r.target.id === "input-box" || e.currentNodes.length === 0) return !1;
|
|
813
810
|
if (r.clipboardData) {
|
|
814
|
-
const a =
|
|
811
|
+
const a = Ce(e.currentNodes).map((h) => h.nodeObj), d = Le({
|
|
815
812
|
magic: Oe,
|
|
816
813
|
data: a
|
|
817
814
|
});
|
|
@@ -836,7 +833,7 @@ function xn(e, t) {
|
|
|
836
833
|
e.pasteHandler && e.pasteHandler(r);
|
|
837
834
|
});
|
|
838
835
|
}
|
|
839
|
-
const
|
|
836
|
+
const vn = function(e, t) {
|
|
840
837
|
if (!t)
|
|
841
838
|
return he(e), e;
|
|
842
839
|
let n = e.querySelector(".insert-preview");
|
|
@@ -847,17 +844,17 @@ const Cn = function(e, t) {
|
|
|
847
844
|
const t = e.querySelectorAll(".insert-preview");
|
|
848
845
|
for (const n of t || [])
|
|
849
846
|
n.remove();
|
|
850
|
-
},
|
|
847
|
+
}, je = function(e, t) {
|
|
851
848
|
for (const n of t) {
|
|
852
849
|
const o = n.parentElement.parentElement.contains(e);
|
|
853
850
|
if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent)) return !1;
|
|
854
851
|
}
|
|
855
852
|
return !0;
|
|
856
|
-
},
|
|
853
|
+
}, wn = function(e) {
|
|
857
854
|
const t = document.createElement("div");
|
|
858
855
|
return t.className = "mind-elixir-ghost", e.container.appendChild(t), t;
|
|
859
856
|
};
|
|
860
|
-
class
|
|
857
|
+
class xn {
|
|
861
858
|
mind;
|
|
862
859
|
isMoving = !1;
|
|
863
860
|
interval = null;
|
|
@@ -874,31 +871,31 @@ class Sn {
|
|
|
874
871
|
this.isMoving = !1, this.interval && (clearInterval(this.interval), this.interval = null);
|
|
875
872
|
}
|
|
876
873
|
}
|
|
877
|
-
function
|
|
874
|
+
function En(e) {
|
|
878
875
|
return {
|
|
879
876
|
isDragging: !1,
|
|
880
877
|
insertType: null,
|
|
881
878
|
meet: null,
|
|
882
|
-
ghost:
|
|
883
|
-
edgeMoveController: new
|
|
879
|
+
ghost: wn(e),
|
|
880
|
+
edgeMoveController: new xn(e),
|
|
884
881
|
startX: 0,
|
|
885
882
|
startY: 0,
|
|
886
883
|
pointerId: null
|
|
887
884
|
};
|
|
888
885
|
}
|
|
889
|
-
const
|
|
886
|
+
const Cn = 5;
|
|
890
887
|
function Ie(e, t, n, o = !1) {
|
|
891
888
|
if (e.spacePressed) return !1;
|
|
892
889
|
const s = n.target;
|
|
893
890
|
if (s?.tagName !== "ME-TPC" || !s.nodeObj.parent) return !1;
|
|
894
891
|
t.startX = n.clientX, t.startY = n.clientY, t.pointerId = n.pointerId, e.selection?.cancel();
|
|
895
892
|
let i = e.currentNodes;
|
|
896
|
-
return i?.includes(s) || (e.selectNode(s), i = e.currentNodes), e.dragged = i, o &&
|
|
893
|
+
return i?.includes(s) || (e.selectNode(s), i = e.currentNodes), e.dragged = i, o && it(e, t), !0;
|
|
897
894
|
}
|
|
898
|
-
function
|
|
895
|
+
function st(e, t, n) {
|
|
899
896
|
e.style.transform = `translate(${t - 10}px, ${n - 10}px)`, e.style.display = "block";
|
|
900
897
|
}
|
|
901
|
-
function
|
|
898
|
+
function it(e, t) {
|
|
902
899
|
const { dragged: n } = e;
|
|
903
900
|
if (!n) return;
|
|
904
901
|
const o = document.activeElement;
|
|
@@ -907,30 +904,30 @@ function lt(e, t) {
|
|
|
907
904
|
s.parentElement.parentElement.style.opacity = "0.5";
|
|
908
905
|
e.dragMoveHelper.clear();
|
|
909
906
|
}
|
|
910
|
-
function
|
|
907
|
+
function Sn(e, t, n) {
|
|
911
908
|
const { dragged: o } = e;
|
|
912
909
|
if (!o || t.pointerId !== n.pointerId) return;
|
|
913
910
|
const s = n.clientX - t.startX, i = n.clientY - t.startY, l = Math.sqrt(s * s + i * i);
|
|
914
|
-
if (!t.isDragging && l >
|
|
911
|
+
if (!t.isDragging && l > Cn && it(e, t), !t.isDragging) return;
|
|
915
912
|
const c = e.container.getBoundingClientRect();
|
|
916
|
-
|
|
913
|
+
st(t.ghost, n.clientX - c.x, n.clientY - c.y), n.clientX < c.x + 50 ? t.edgeMoveController.move(1, 0) : n.clientX > c.x + c.width - 50 ? t.edgeMoveController.move(-1, 0) : n.clientY < c.y + 50 ? t.edgeMoveController.move(0, 1) : n.clientY > c.y + c.height - 50 ? t.edgeMoveController.move(0, -1) : t.edgeMoveController.stop(), he(t.meet);
|
|
917
914
|
const r = 12 * e.scaleVal, a = document.elementFromPoint(n.clientX, n.clientY - r);
|
|
918
|
-
if (
|
|
915
|
+
if (je(a, o)) {
|
|
919
916
|
t.meet = a;
|
|
920
917
|
const d = a.getBoundingClientRect(), h = d.y;
|
|
921
918
|
n.clientY > h + d.height ? t.insertType = "after" : t.insertType = "in";
|
|
922
919
|
} else {
|
|
923
920
|
const d = document.elementFromPoint(n.clientX, n.clientY + r);
|
|
924
|
-
if (
|
|
921
|
+
if (je(d, o)) {
|
|
925
922
|
t.meet = d;
|
|
926
923
|
const u = d.getBoundingClientRect().y;
|
|
927
924
|
n.clientY < u ? t.insertType = "before" : t.insertType = "in";
|
|
928
925
|
} else
|
|
929
926
|
t.insertType = null, t.meet = null;
|
|
930
927
|
}
|
|
931
|
-
t.meet &&
|
|
928
|
+
t.meet && vn(t.meet, t.insertType);
|
|
932
929
|
}
|
|
933
|
-
function
|
|
930
|
+
function Nn(e, t, n) {
|
|
934
931
|
const { dragged: o } = e;
|
|
935
932
|
if (!(!o || t.pointerId !== n.pointerId)) {
|
|
936
933
|
t.edgeMoveController.stop();
|
|
@@ -948,26 +945,26 @@ function pe(e, t) {
|
|
|
948
945
|
t.meet && he(t.meet), t.ghost.style.display = "none", t.ghost.innerHTML = "", e.dragged = null, t.isDragging = !1, t.insertType = null, t.meet = null, t.pointerId = null;
|
|
949
946
|
}
|
|
950
947
|
}
|
|
951
|
-
function
|
|
948
|
+
function Tn(e) {
|
|
952
949
|
return () => {
|
|
953
950
|
};
|
|
954
951
|
}
|
|
955
|
-
function
|
|
952
|
+
function _n(e) {
|
|
956
953
|
const { dragMoveHelper: t } = e;
|
|
957
954
|
let n = 0;
|
|
958
955
|
e.spacePressed = !1;
|
|
959
956
|
let o = null;
|
|
960
|
-
const s = /* @__PURE__ */ new Map(), i =
|
|
957
|
+
const s = /* @__PURE__ */ new Map(), i = En(e);
|
|
961
958
|
let l = null, c = null, r = null, a = null;
|
|
962
959
|
const d = 500, h = 10, u = () => {
|
|
963
960
|
l !== null && (clearTimeout(l), l = null, c = null, r = null, a = null);
|
|
964
961
|
}, y = (f, w) => {
|
|
965
962
|
f.hasPointerCapture && f.hasPointerCapture(w) && f.releasePointerCapture(w);
|
|
966
|
-
},
|
|
963
|
+
}, b = (f, w) => {
|
|
967
964
|
if (f.id === "input-box" || f.closest("#input-box")) return !1;
|
|
968
|
-
const
|
|
969
|
-
if (
|
|
970
|
-
const M =
|
|
965
|
+
const T = f.closest(".svg-label");
|
|
966
|
+
if (T) {
|
|
967
|
+
const M = T.dataset.svgId, te = T.dataset.type, Z = document.getElementById(M);
|
|
971
968
|
if (Z) {
|
|
972
969
|
if (te === "arrow")
|
|
973
970
|
return w ? e.editArrowLabel(Z) : e.selectArrow(Z), !0;
|
|
@@ -1009,56 +1006,56 @@ function An(e) {
|
|
|
1009
1006
|
e.selectNode(w);
|
|
1010
1007
|
else if (!e.editable)
|
|
1011
1008
|
return;
|
|
1012
|
-
|
|
1009
|
+
b(w, !1);
|
|
1013
1010
|
}, g = (f) => {
|
|
1014
1011
|
if (!e.editable) return;
|
|
1015
1012
|
const w = f.target;
|
|
1016
|
-
re(w) && e.beginEdit(w),
|
|
1013
|
+
re(w) && e.beginEdit(w), b(w, !0);
|
|
1017
1014
|
}, m = (f) => {
|
|
1018
1015
|
if (f.pointerType === "mouse" || s.size > 1) return;
|
|
1019
|
-
const w = (/* @__PURE__ */ new Date()).getTime(),
|
|
1020
|
-
|
|
1021
|
-
},
|
|
1016
|
+
const w = (/* @__PURE__ */ new Date()).getTime(), T = w - n;
|
|
1017
|
+
T < 300 && T > 0 && g(f), n = w;
|
|
1018
|
+
}, v = (f) => {
|
|
1022
1019
|
f.code === "Space" && (e.spacePressed = !0, e.container.classList.add("space-pressed"));
|
|
1023
|
-
},
|
|
1020
|
+
}, E = (f) => {
|
|
1024
1021
|
f.code === "Space" && (e.spacePressed = !1, e.container.classList.remove("space-pressed"));
|
|
1025
|
-
},
|
|
1022
|
+
}, k = (f) => {
|
|
1026
1023
|
if (f.pointerType === "touch" && (s.set(f.pointerId, { x: f.clientX, y: f.clientY }), s.size === 2)) {
|
|
1027
1024
|
const [M, te] = Array.from(s.values());
|
|
1028
1025
|
o = Pe(M, te), u();
|
|
1029
1026
|
}
|
|
1030
1027
|
t.moved = !1;
|
|
1031
|
-
const w = f.target,
|
|
1028
|
+
const w = f.target, T = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
1032
1029
|
if (e.editable && i && (f.button === 0 || f.pointerType === "touch")) {
|
|
1033
1030
|
if (f.pointerType === "touch" && s.size > 1)
|
|
1034
1031
|
(i.isDragging || i.pointerId !== null) && pe(e, i);
|
|
1035
1032
|
else if (f.pointerType === "touch" && s.size === 1)
|
|
1036
1033
|
(re(w) || w.closest("me-tpc")) && (c = { x: f.clientX, y: f.clientY }, r = w, a = f.pointerId, l = window.setTimeout(() => {
|
|
1037
|
-
Ie(e, i, f, !0) && (r && r.setPointerCapture(f.pointerId),
|
|
1034
|
+
Ie(e, i, f, !0) && (r && r.setPointerCapture(f.pointerId), st(i.ghost, f.clientX, f.clientY)), l = null, c = null, r = null, a = null;
|
|
1038
1035
|
}, d));
|
|
1039
1036
|
else if (f.pointerType === "mouse" && Ie(e, i, f, !1)) {
|
|
1040
1037
|
w.setPointerCapture(f.pointerId);
|
|
1041
1038
|
return;
|
|
1042
1039
|
}
|
|
1043
1040
|
}
|
|
1044
|
-
const O = e.spacePressed && f.button === 0 && f.pointerType === "mouse",
|
|
1045
|
-
!O && !
|
|
1046
|
-
},
|
|
1041
|
+
const O = e.spacePressed && f.button === 0 && f.pointerType === "mouse", X = !e.editable || f.button === T && f.pointerType === "mouse" || f.pointerType === "touch";
|
|
1042
|
+
!O && !X || (t.x = f.clientX, t.y = f.clientY, w.className !== "circle" && w.contentEditable !== "plaintext-only" && (t.mousedown = !0, w.setPointerCapture(f.pointerId)));
|
|
1043
|
+
}, _ = (f) => {
|
|
1047
1044
|
if (f.pointerType === "touch" && s.has(f.pointerId)) {
|
|
1048
1045
|
if (s.set(f.pointerId, { x: f.clientX, y: f.clientY }), l !== null && c !== null && f.pointerId === a) {
|
|
1049
|
-
const w = f.clientX - c.x,
|
|
1050
|
-
Math.sqrt(w * w +
|
|
1046
|
+
const w = f.clientX - c.x, T = f.clientY - c.y;
|
|
1047
|
+
Math.sqrt(w * w + T * T) > h && u();
|
|
1051
1048
|
}
|
|
1052
1049
|
if (s.size >= 2) {
|
|
1053
|
-
const [w,
|
|
1050
|
+
const [w, T] = Array.from(s.values()), O = Pe(w, T);
|
|
1054
1051
|
if (o == null)
|
|
1055
1052
|
o = O;
|
|
1056
1053
|
else {
|
|
1057
1054
|
if (o > 0) {
|
|
1058
|
-
const
|
|
1059
|
-
e.scale(e.scaleVal *
|
|
1060
|
-
x: (w.x +
|
|
1061
|
-
y: (w.y +
|
|
1055
|
+
const X = O / o;
|
|
1056
|
+
e.scale(e.scaleVal * X, {
|
|
1057
|
+
x: (w.x + T.x) / 2,
|
|
1058
|
+
y: (w.y + T.y) / 2
|
|
1062
1059
|
});
|
|
1063
1060
|
}
|
|
1064
1061
|
o = O;
|
|
@@ -1066,49 +1063,49 @@ function An(e) {
|
|
|
1066
1063
|
return;
|
|
1067
1064
|
}
|
|
1068
1065
|
}
|
|
1069
|
-
if (!(i && i.pointerId !== null && (
|
|
1066
|
+
if (!(i && i.pointerId !== null && (Sn(e, i, f), i.isDragging))) {
|
|
1070
1067
|
if (f.target.contentEditable !== "plaintext-only" || e.spacePressed && t.mousedown) {
|
|
1071
|
-
const w = f.clientX - t.x,
|
|
1072
|
-
t.onMove(w,
|
|
1068
|
+
const w = f.clientX - t.x, T = f.clientY - t.y;
|
|
1069
|
+
t.onMove(w, T);
|
|
1073
1070
|
}
|
|
1074
1071
|
t.x = f.clientX, t.y = f.clientY;
|
|
1075
1072
|
}
|
|
1076
|
-
},
|
|
1073
|
+
}, C = (f) => {
|
|
1077
1074
|
if (f.pointerType === "touch" && (s.delete(f.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId !== null) {
|
|
1078
1075
|
const w = i.isDragging;
|
|
1079
|
-
if (
|
|
1076
|
+
if (Nn(e, i, f), y(f.target, f.pointerId), w)
|
|
1080
1077
|
return;
|
|
1081
1078
|
}
|
|
1082
1079
|
t.mousedown && (y(f.target, f.pointerId), t.clear());
|
|
1083
|
-
},
|
|
1080
|
+
}, x = () => {
|
|
1084
1081
|
u(), t.mousedown && t.clear(), i && (i.isDragging || i.pointerId !== null) && pe(e, i);
|
|
1085
|
-
}, S = (f) => {
|
|
1086
|
-
f.pointerType === "touch" && (s.delete(f.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId === f.pointerId && pe(e, i), E(f);
|
|
1087
1082
|
}, N = (f) => {
|
|
1083
|
+
f.pointerType === "touch" && (s.delete(f.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId === f.pointerId && pe(e, i), C(f);
|
|
1084
|
+
}, S = (f) => {
|
|
1088
1085
|
if (f.preventDefault(), f.button !== 2 || !e.editable) return;
|
|
1089
1086
|
const w = f.target;
|
|
1090
1087
|
re(w) && !w.classList.contains("selected") && e.selectNode(w), setTimeout(() => {
|
|
1091
1088
|
e.dragMoveHelper.moved || e.bus.fire("showContextMenu", f);
|
|
1092
1089
|
}, 200);
|
|
1093
|
-
},
|
|
1090
|
+
}, A = (f) => {
|
|
1094
1091
|
f.stopPropagation(), f.preventDefault(), f.ctrlKey || f.metaKey ? f.deltaY < 0 ? ae(e, "in", e.dragMoveHelper) : e.scaleVal - e.scaleSensitivity > 0 && ae(e, "out", e.dragMoveHelper) : f.shiftKey ? e.move(-f.deltaY, 0) : e.move(-f.deltaX, -f.deltaY);
|
|
1095
|
-
}, { container:
|
|
1096
|
-
return
|
|
1097
|
-
{ dom:
|
|
1098
|
-
{ dom:
|
|
1099
|
-
{ dom:
|
|
1100
|
-
{ dom:
|
|
1101
|
-
{ dom:
|
|
1102
|
-
{ dom:
|
|
1103
|
-
{ dom:
|
|
1104
|
-
{ dom:
|
|
1105
|
-
{ dom:
|
|
1106
|
-
{ dom:
|
|
1107
|
-
{ dom:
|
|
1108
|
-
{ dom:
|
|
1092
|
+
}, { container: L } = e;
|
|
1093
|
+
return Je([
|
|
1094
|
+
{ dom: L, evt: "pointerdown", func: k },
|
|
1095
|
+
{ dom: L, evt: "pointermove", func: _ },
|
|
1096
|
+
{ dom: L, evt: "pointerup", func: C },
|
|
1097
|
+
{ dom: L, evt: "pointercancel", func: N },
|
|
1098
|
+
{ dom: L, evt: "pointerdown", func: m },
|
|
1099
|
+
{ dom: L, evt: "click", func: p },
|
|
1100
|
+
{ dom: L, evt: "dblclick", func: g },
|
|
1101
|
+
{ dom: L, evt: "contextmenu", func: S },
|
|
1102
|
+
{ dom: L, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : A },
|
|
1103
|
+
{ dom: L, evt: "blur", func: x },
|
|
1104
|
+
{ dom: L, evt: "keydown", func: v },
|
|
1105
|
+
{ dom: L, evt: "keyup", func: E }
|
|
1109
1106
|
]);
|
|
1110
1107
|
}
|
|
1111
|
-
function
|
|
1108
|
+
function kn() {
|
|
1112
1109
|
return {
|
|
1113
1110
|
handlers: {},
|
|
1114
1111
|
addListener: function(e, t) {
|
|
@@ -1132,7 +1129,7 @@ function Dn() {
|
|
|
1132
1129
|
}
|
|
1133
1130
|
};
|
|
1134
1131
|
}
|
|
1135
|
-
const
|
|
1132
|
+
const j = "http://www.w3.org/2000/svg", fe = function(e) {
|
|
1136
1133
|
const t = e.clientWidth, n = e.clientHeight, o = e.dataset, s = Number(o.x), i = Number(o.y), l = o.anchor;
|
|
1137
1134
|
let c = s;
|
|
1138
1135
|
l === "middle" ? c = s - t / 2 : l === "end" && (c = s - t), e.style.left = `${c}px`, e.style.top = `${i - n / 2}px`, e.style.visibility = "visible";
|
|
@@ -1141,22 +1138,22 @@ const H = "http://www.w3.org/2000/svg", fe = function(e) {
|
|
|
1141
1138
|
r.className = "svg-label", r.style.color = i || "#666";
|
|
1142
1139
|
const a = "label-" + c;
|
|
1143
1140
|
return r.id = a, r.innerHTML = e, r.dataset.type = l, r.dataset.svgId = c, r.dataset.x = t.toString(), r.dataset.y = n.toString(), r.dataset.anchor = s, r;
|
|
1144
|
-
},
|
|
1145
|
-
const o = document.createElementNS(
|
|
1146
|
-
return
|
|
1141
|
+
}, rt = function(e, t, n) {
|
|
1142
|
+
const o = document.createElementNS(j, "path");
|
|
1143
|
+
return D(o, {
|
|
1147
1144
|
d: e,
|
|
1148
1145
|
stroke: t || "#666",
|
|
1149
1146
|
fill: "none",
|
|
1150
1147
|
"stroke-width": n
|
|
1151
1148
|
}), o;
|
|
1152
1149
|
}, Q = function(e) {
|
|
1153
|
-
const t = document.createElementNS(
|
|
1150
|
+
const t = document.createElementNS(j, "svg");
|
|
1154
1151
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
1155
1152
|
}, Re = function() {
|
|
1156
|
-
const e = document.createElementNS(
|
|
1153
|
+
const e = document.createElementNS(j, "line");
|
|
1157
1154
|
return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
|
|
1158
|
-
},
|
|
1159
|
-
const s = document.createElementNS(
|
|
1155
|
+
}, Ln = function(e, t, n, o) {
|
|
1156
|
+
const s = document.createElementNS(j, "g");
|
|
1160
1157
|
return [
|
|
1161
1158
|
{
|
|
1162
1159
|
name: "line",
|
|
@@ -1171,30 +1168,30 @@ const H = "http://www.w3.org/2000/svg", fe = function(e) {
|
|
|
1171
1168
|
d: n
|
|
1172
1169
|
}
|
|
1173
1170
|
].forEach((l, c) => {
|
|
1174
|
-
const r = l.d, a = document.createElementNS(
|
|
1171
|
+
const r = l.d, a = document.createElementNS(j, "path"), d = {
|
|
1175
1172
|
d: r,
|
|
1176
1173
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
1177
1174
|
fill: "none",
|
|
1178
1175
|
"stroke-linecap": o?.strokeLinecap || "cap",
|
|
1179
1176
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
1180
1177
|
};
|
|
1181
|
-
o?.opacity !== void 0 && (d.opacity = String(o.opacity)),
|
|
1182
|
-
const h = document.createElementNS(
|
|
1183
|
-
|
|
1178
|
+
o?.opacity !== void 0 && (d.opacity = String(o.opacity)), D(a, d), c === 0 && a.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
1179
|
+
const h = document.createElementNS(j, "path");
|
|
1180
|
+
D(h, {
|
|
1184
1181
|
d: r,
|
|
1185
1182
|
stroke: "transparent",
|
|
1186
1183
|
fill: "none",
|
|
1187
1184
|
"stroke-width": "15"
|
|
1188
1185
|
}), s.appendChild(h), s.appendChild(a), s[l.name] = a;
|
|
1189
1186
|
}), s;
|
|
1190
|
-
},
|
|
1187
|
+
}, lt = function(e, t, n) {
|
|
1191
1188
|
if (!t) return;
|
|
1192
1189
|
const o = n.label, s = t.cloneNode(!0);
|
|
1193
1190
|
e.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
|
|
1194
1191
|
left:${t.style.left};
|
|
1195
1192
|
top:${t.style.top};
|
|
1196
1193
|
max-width: 200px;
|
|
1197
|
-
`,
|
|
1194
|
+
`, Qe(s), e.scrollIntoView(s), s.addEventListener("keydown", (i) => {
|
|
1198
1195
|
i.stopPropagation();
|
|
1199
1196
|
const l = i.key;
|
|
1200
1197
|
if (l === "Enter" || l === "Tab") {
|
|
@@ -1212,259 +1209,118 @@ const H = "http://www.w3.org/2000/svg", fe = function(e) {
|
|
|
1212
1209
|
obj: n
|
|
1213
1210
|
}));
|
|
1214
1211
|
});
|
|
1215
|
-
},
|
|
1212
|
+
}, Dn = function(e) {
|
|
1216
1213
|
const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, s = t.offsetWidth, i = t.offsetHeight, l = this.map.querySelectorAll("me-main > me-wrapper");
|
|
1217
1214
|
this.lines.innerHTML = "";
|
|
1218
1215
|
for (let c = 0; c < l.length; c++) {
|
|
1219
|
-
const r = l[c], a = r.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } =
|
|
1220
|
-
if (a.style.borderColor = m, this.lines.appendChild(
|
|
1216
|
+
const r = l[c], a = r.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } = H(this.nodes, a), u = a.offsetWidth, y = a.offsetHeight, b = r.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: h, cL: d, cW: u, cH: y, direction: b, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, m = a.nodeObj.branchColor || g[c % g.length];
|
|
1217
|
+
if (a.style.borderColor = m, this.lines.appendChild(rt(p, m, "3")), e && e !== r)
|
|
1221
1218
|
continue;
|
|
1222
|
-
const
|
|
1223
|
-
|
|
1219
|
+
const v = Q("subLines"), E = r.lastChild;
|
|
1220
|
+
E.tagName === "svg" && E.remove(), r.appendChild(v), ct(this, v, m, r, b, !0);
|
|
1224
1221
|
}
|
|
1225
1222
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
1226
|
-
},
|
|
1223
|
+
}, ct = function(e, t, n, o, s, i) {
|
|
1227
1224
|
const l = o.firstChild, c = o.children[1].children;
|
|
1228
1225
|
if (c.length === 0) return;
|
|
1229
1226
|
const r = l.offsetTop, a = l.offsetLeft, d = l.offsetWidth, h = l.offsetHeight;
|
|
1230
1227
|
for (let u = 0; u < c.length; u++) {
|
|
1231
|
-
const y = c[u],
|
|
1232
|
-
t.appendChild(
|
|
1233
|
-
const
|
|
1234
|
-
if (
|
|
1235
|
-
if (!
|
|
1228
|
+
const y = c[u], b = y.firstChild, p = b.offsetTop, g = b.offsetLeft, m = b.offsetWidth, v = b.offsetHeight, E = b.firstChild.nodeObj.branchColor || n, k = e.generateSubBranch({ pT: r, pL: a, pW: d, pH: h, cT: p, cL: g, cW: m, cH: v, direction: s, isFirst: i });
|
|
1229
|
+
t.appendChild(rt(k, E, "2"));
|
|
1230
|
+
const _ = b.children[1];
|
|
1231
|
+
if (_) {
|
|
1232
|
+
if (!_.expanded) continue;
|
|
1236
1233
|
} else
|
|
1237
1234
|
continue;
|
|
1238
|
-
|
|
1239
|
-
}
|
|
1240
|
-
},
|
|
1241
|
-
addChild: "
|
|
1242
|
-
addParent: "
|
|
1243
|
-
addSibling: "
|
|
1244
|
-
removeNode: "
|
|
1245
|
-
focus: "
|
|
1246
|
-
cancelFocus: "
|
|
1247
|
-
moveUp: "
|
|
1248
|
-
moveDown: "
|
|
1249
|
-
link: "
|
|
1250
|
-
linkBidirectional: "
|
|
1251
|
-
clickTips: "
|
|
1252
|
-
summary: "
|
|
1253
|
-
}, Fe = {
|
|
1254
|
-
cn: Be,
|
|
1255
|
-
zh_CN: Be,
|
|
1256
|
-
zh_TW: {
|
|
1257
|
-
addChild: "插入子節點",
|
|
1258
|
-
addParent: "插入父節點",
|
|
1259
|
-
addSibling: "插入同級節點",
|
|
1260
|
-
removeNode: "刪除節點",
|
|
1261
|
-
focus: "專注",
|
|
1262
|
-
cancelFocus: "取消專注",
|
|
1263
|
-
moveUp: "上移",
|
|
1264
|
-
moveDown: "下移",
|
|
1265
|
-
link: "連接",
|
|
1266
|
-
linkBidirectional: "雙向連接",
|
|
1267
|
-
clickTips: "請點擊目標節點",
|
|
1268
|
-
summary: "摘要"
|
|
1269
|
-
},
|
|
1270
|
-
en: {
|
|
1271
|
-
addChild: "Add child",
|
|
1272
|
-
addParent: "Add parent",
|
|
1273
|
-
addSibling: "Add sibling",
|
|
1274
|
-
removeNode: "Remove node",
|
|
1275
|
-
focus: "Focus Mode",
|
|
1276
|
-
cancelFocus: "Cancel Focus Mode",
|
|
1277
|
-
moveUp: "Move up",
|
|
1278
|
-
moveDown: "Move down",
|
|
1279
|
-
link: "Link",
|
|
1280
|
-
linkBidirectional: "Bidirectional Link",
|
|
1281
|
-
clickTips: "Please click the target node",
|
|
1282
|
-
summary: "Summary"
|
|
1283
|
-
},
|
|
1284
|
-
ru: {
|
|
1285
|
-
addChild: "Добавить дочерний элемент",
|
|
1286
|
-
addParent: "Добавить родительский элемент",
|
|
1287
|
-
addSibling: "Добавить на этом уровне",
|
|
1288
|
-
removeNode: "Удалить узел",
|
|
1289
|
-
focus: "Режим фокусировки",
|
|
1290
|
-
cancelFocus: "Отменить режим фокусировки",
|
|
1291
|
-
moveUp: "Поднять выше",
|
|
1292
|
-
moveDown: "Опустить ниже",
|
|
1293
|
-
link: "Ссылка",
|
|
1294
|
-
linkBidirectional: "Двунаправленная ссылка",
|
|
1295
|
-
clickTips: "Пожалуйста, нажмите на целевой узел",
|
|
1296
|
-
summary: "Описание"
|
|
1297
|
-
},
|
|
1298
|
-
ja: {
|
|
1299
|
-
addChild: "子ノードを追加する",
|
|
1300
|
-
addParent: "親ノードを追加します",
|
|
1301
|
-
addSibling: "兄弟ノードを追加する",
|
|
1302
|
-
removeNode: "ノードを削除",
|
|
1303
|
-
focus: "集中",
|
|
1304
|
-
cancelFocus: "集中解除",
|
|
1305
|
-
moveUp: "上へ移動",
|
|
1306
|
-
moveDown: "下へ移動",
|
|
1307
|
-
link: "コネクト",
|
|
1308
|
-
linkBidirectional: "双方向リンク",
|
|
1309
|
-
clickTips: "ターゲットノードをクリックしてください",
|
|
1310
|
-
summary: "概要"
|
|
1311
|
-
},
|
|
1312
|
-
pt: {
|
|
1313
|
-
addChild: "Adicionar item filho",
|
|
1314
|
-
addParent: "Adicionar item pai",
|
|
1315
|
-
addSibling: "Adicionar item irmao",
|
|
1316
|
-
removeNode: "Remover item",
|
|
1317
|
-
focus: "Modo Foco",
|
|
1318
|
-
cancelFocus: "Cancelar Modo Foco",
|
|
1319
|
-
moveUp: "Mover para cima",
|
|
1320
|
-
moveDown: "Mover para baixo",
|
|
1321
|
-
link: "Link",
|
|
1322
|
-
linkBidirectional: "Link bidirecional",
|
|
1323
|
-
clickTips: "Favor clicar no item alvo",
|
|
1324
|
-
summary: "Resumo"
|
|
1325
|
-
},
|
|
1326
|
-
it: {
|
|
1327
|
-
addChild: "Aggiungi figlio",
|
|
1328
|
-
addParent: "Aggiungi genitore",
|
|
1329
|
-
addSibling: "Aggiungi fratello",
|
|
1330
|
-
removeNode: "Rimuovi nodo",
|
|
1331
|
-
focus: "Modalità Focus",
|
|
1332
|
-
cancelFocus: "Annulla Modalità Focus",
|
|
1333
|
-
moveUp: "Sposta su",
|
|
1334
|
-
moveDown: "Sposta giù",
|
|
1335
|
-
link: "Collega",
|
|
1336
|
-
linkBidirectional: "Collegamento bidirezionale",
|
|
1337
|
-
clickTips: "Si prega di fare clic sul nodo di destinazione",
|
|
1338
|
-
summary: "Unisci nodi"
|
|
1339
|
-
},
|
|
1340
|
-
es: {
|
|
1341
|
-
addChild: "Agregar hijo",
|
|
1342
|
-
addParent: "Agregar padre",
|
|
1343
|
-
addSibling: "Agregar hermano",
|
|
1344
|
-
removeNode: "Eliminar nodo",
|
|
1345
|
-
focus: "Modo Enfoque",
|
|
1346
|
-
cancelFocus: "Cancelar Modo Enfoque",
|
|
1347
|
-
moveUp: "Mover hacia arriba",
|
|
1348
|
-
moveDown: "Mover hacia abajo",
|
|
1349
|
-
link: "Enlace",
|
|
1350
|
-
linkBidirectional: "Enlace bidireccional",
|
|
1351
|
-
clickTips: "Por favor haga clic en el nodo de destino",
|
|
1352
|
-
summary: "Resumen"
|
|
1353
|
-
},
|
|
1354
|
-
fr: {
|
|
1355
|
-
addChild: "Ajout enfant",
|
|
1356
|
-
addParent: "Ajout parent",
|
|
1357
|
-
addSibling: "Ajout voisin",
|
|
1358
|
-
removeNode: "Supprimer",
|
|
1359
|
-
focus: "Cibler",
|
|
1360
|
-
cancelFocus: "Retour",
|
|
1361
|
-
moveUp: "Monter",
|
|
1362
|
-
moveDown: "Descendre",
|
|
1363
|
-
link: "Lier",
|
|
1364
|
-
linkBidirectional: "Lien bidirectionnel",
|
|
1365
|
-
clickTips: "Cliquer sur le noeud cible",
|
|
1366
|
-
summary: "Annoter"
|
|
1367
|
-
},
|
|
1368
|
-
ko: {
|
|
1369
|
-
addChild: "자식 추가",
|
|
1370
|
-
addParent: "부모 추가",
|
|
1371
|
-
addSibling: "형제 추가",
|
|
1372
|
-
removeNode: "노드 삭제",
|
|
1373
|
-
focus: "포커스 모드",
|
|
1374
|
-
cancelFocus: "포커스 모드 취소",
|
|
1375
|
-
moveUp: "위로 이동",
|
|
1376
|
-
moveDown: "아래로 이동",
|
|
1377
|
-
link: "연결",
|
|
1378
|
-
linkBidirectional: "양방향 연결",
|
|
1379
|
-
clickTips: "대상 노드를 클릭하십시오",
|
|
1380
|
-
summary: "요약"
|
|
1381
|
-
},
|
|
1382
|
-
ro: {
|
|
1383
|
-
addChild: "Adaugă sub-nod",
|
|
1384
|
-
addParent: "Adaugă nod părinte",
|
|
1385
|
-
addSibling: "Adaugă nod la același nivel",
|
|
1386
|
-
removeNode: "Șterge nodul",
|
|
1387
|
-
focus: "Focalizare",
|
|
1388
|
-
cancelFocus: "Anulează focalizarea",
|
|
1389
|
-
moveUp: "Mută în sus",
|
|
1390
|
-
moveDown: "Mută în jos",
|
|
1391
|
-
link: "Creează legătură",
|
|
1392
|
-
linkBidirectional: "Creează legătură bidirecțională",
|
|
1393
|
-
clickTips: "Click pe nodul țintă",
|
|
1394
|
-
summary: "Rezumat"
|
|
1395
|
-
}
|
|
1235
|
+
ct(e, t, E, y, s);
|
|
1236
|
+
}
|
|
1237
|
+
}, An = {
|
|
1238
|
+
addChild: "Add child",
|
|
1239
|
+
addParent: "Add parent",
|
|
1240
|
+
addSibling: "Add sibling",
|
|
1241
|
+
removeNode: "Remove node",
|
|
1242
|
+
focus: "Focus Mode",
|
|
1243
|
+
cancelFocus: "Cancel Focus Mode",
|
|
1244
|
+
moveUp: "Move up",
|
|
1245
|
+
moveDown: "Move down",
|
|
1246
|
+
link: "Link",
|
|
1247
|
+
linkBidirectional: "Bidirectional Link",
|
|
1248
|
+
clickTips: "Please click the target node",
|
|
1249
|
+
summary: "Summary"
|
|
1396
1250
|
};
|
|
1397
|
-
function
|
|
1398
|
-
|
|
1251
|
+
function Mn(e, t) {
|
|
1252
|
+
const n = {
|
|
1399
1253
|
focus: !0,
|
|
1400
|
-
link: !0
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1254
|
+
link: !0,
|
|
1255
|
+
locale: An
|
|
1256
|
+
};
|
|
1257
|
+
t = t === !0 ? n : Object.assign(n, t);
|
|
1258
|
+
const o = (C) => {
|
|
1259
|
+
const x = document.createElement("div");
|
|
1260
|
+
return x.innerText = C, x.className = "tips", x;
|
|
1261
|
+
}, s = (C, x, N) => {
|
|
1262
|
+
const S = document.createElement("li");
|
|
1263
|
+
return S.id = C, S.innerHTML = `<span>${me(x)}</span><span ${N ? 'class="key"' : ""}>${me(N)}</span>`, S;
|
|
1264
|
+
}, i = t.locale, l = s("cm-add_child", i.addChild, "Tab"), c = s("cm-add_parent", i.addParent, "Ctrl + Enter"), r = s("cm-add_sibling", i.addSibling, "Enter"), a = s("cm-remove_child", i.removeNode, "Delete"), d = s("cm-fucus", i.focus, ""), h = s("cm-unfucus", i.cancelFocus, ""), u = s("cm-up", i.moveUp, "PgUp"), y = s("cm-down", i.moveDown, "Pgdn"), b = s("cm-link", i.link, ""), p = s("cm-link-bidirectional", i.linkBidirectional, ""), g = s("cm-summary", i.summary, ""), m = document.createElement("ul");
|
|
1265
|
+
if (m.className = "menu-list", m.appendChild(l), m.appendChild(c), m.appendChild(r), m.appendChild(a), t.focus && (m.appendChild(d), m.appendChild(h)), m.appendChild(u), m.appendChild(y), m.appendChild(g), t.link && (m.appendChild(b), m.appendChild(p)), t && t.extend)
|
|
1266
|
+
for (let C = 0; C < t.extend.length; C++) {
|
|
1267
|
+
const x = t.extend[C], N = s(x.name, x.name, x.key || "");
|
|
1268
|
+
m.appendChild(N), N.onclick = (S) => {
|
|
1269
|
+
x.onclick(S);
|
|
1414
1270
|
};
|
|
1415
1271
|
}
|
|
1416
|
-
const
|
|
1417
|
-
|
|
1418
|
-
let
|
|
1419
|
-
const
|
|
1420
|
-
const
|
|
1421
|
-
if (re(
|
|
1422
|
-
|
|
1423
|
-
const
|
|
1424
|
-
|
|
1272
|
+
const v = document.createElement("div");
|
|
1273
|
+
v.className = "context-menu", v.appendChild(m), v.hidden = !0, e.container.append(v);
|
|
1274
|
+
let E = !0;
|
|
1275
|
+
const k = (C) => {
|
|
1276
|
+
const x = C.target;
|
|
1277
|
+
if (re(x)) {
|
|
1278
|
+
x.parentElement.tagName === "ME-ROOT" ? E = !0 : E = !1, E ? (d.className = "disabled", u.className = "disabled", y.className = "disabled", c.className = "disabled", r.className = "disabled", a.className = "disabled") : (d.className = "", u.className = "", y.className = "", c.className = "", r.className = "", a.className = ""), v.hidden = !1, m.style.top = "", m.style.bottom = "", m.style.left = "", m.style.right = "";
|
|
1279
|
+
const N = m.offsetHeight, S = m.offsetWidth, A = m.getBoundingClientRect(), L = C.clientY - A.top, R = C.clientX - A.left;
|
|
1280
|
+
N + L > window.innerHeight ? (m.style.top = "", m.style.bottom = "0px") : (m.style.bottom = "", m.style.top = L + 15 + "px"), S + R > window.innerWidth ? (m.style.left = "", m.style.right = "0px") : (m.style.right = "", m.style.left = R + 10 + "px");
|
|
1425
1281
|
}
|
|
1426
1282
|
};
|
|
1427
|
-
e.bus.addListener("showContextMenu",
|
|
1428
|
-
|
|
1283
|
+
e.bus.addListener("showContextMenu", k), v.onclick = (C) => {
|
|
1284
|
+
C.target === v && (v.hidden = !0);
|
|
1429
1285
|
}, l.onclick = () => {
|
|
1430
|
-
e.addChild(),
|
|
1286
|
+
e.addChild(), v.hidden = !0;
|
|
1431
1287
|
}, c.onclick = () => {
|
|
1432
|
-
e.insertParent(),
|
|
1288
|
+
e.insertParent(), v.hidden = !0;
|
|
1433
1289
|
}, r.onclick = () => {
|
|
1434
|
-
|
|
1290
|
+
E || (e.insertSibling("after"), v.hidden = !0);
|
|
1435
1291
|
}, a.onclick = () => {
|
|
1436
|
-
|
|
1292
|
+
E || (e.removeNodes(e.currentNodes || []), v.hidden = !0);
|
|
1437
1293
|
}, d.onclick = () => {
|
|
1438
|
-
|
|
1294
|
+
E || (e.focusNode(e.currentNode), v.hidden = !0);
|
|
1439
1295
|
}, h.onclick = () => {
|
|
1440
|
-
e.cancelFocus(),
|
|
1296
|
+
e.cancelFocus(), v.hidden = !0;
|
|
1441
1297
|
}, u.onclick = () => {
|
|
1442
|
-
|
|
1298
|
+
E || (e.moveUpNode(), v.hidden = !0);
|
|
1443
1299
|
}, y.onclick = () => {
|
|
1444
|
-
|
|
1300
|
+
E || (e.moveDownNode(), v.hidden = !0);
|
|
1445
1301
|
};
|
|
1446
|
-
const
|
|
1447
|
-
|
|
1448
|
-
const
|
|
1449
|
-
e.container.appendChild(
|
|
1302
|
+
const _ = (C) => {
|
|
1303
|
+
v.hidden = !0;
|
|
1304
|
+
const x = e.currentNode, N = o(i.clickTips);
|
|
1305
|
+
e.container.appendChild(N), e.map.addEventListener(
|
|
1450
1306
|
"click",
|
|
1451
|
-
(
|
|
1452
|
-
|
|
1453
|
-
const
|
|
1454
|
-
(
|
|
1307
|
+
(S) => {
|
|
1308
|
+
S.preventDefault(), N.remove();
|
|
1309
|
+
const A = S.target;
|
|
1310
|
+
(A.parentElement.tagName === "ME-PARENT" || A.parentElement.tagName === "ME-ROOT") && e.createArrow(x, A, C);
|
|
1455
1311
|
},
|
|
1456
1312
|
{
|
|
1457
1313
|
once: !0
|
|
1458
1314
|
}
|
|
1459
1315
|
);
|
|
1460
1316
|
};
|
|
1461
|
-
return
|
|
1462
|
-
|
|
1317
|
+
return b.onclick = () => _(), p.onclick = () => _({ bidirectional: !0 }), g.onclick = () => {
|
|
1318
|
+
v.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
|
|
1463
1319
|
}, () => {
|
|
1464
|
-
l.onclick = null, c.onclick = null, r.onclick = null, a.onclick = null, d.onclick = null, h.onclick = null, u.onclick = null, y.onclick = null,
|
|
1320
|
+
l.onclick = null, c.onclick = null, r.onclick = null, a.onclick = null, d.onclick = null, h.onclick = null, u.onclick = null, y.onclick = null, b.onclick = null, g.onclick = null, v.onclick = null, e.container.oncontextmenu = null;
|
|
1465
1321
|
};
|
|
1466
1322
|
}
|
|
1467
|
-
const
|
|
1323
|
+
const Pn = function(e) {
|
|
1468
1324
|
return ["createSummary", "removeSummary", "finishEditSummary"].includes(e.name) ? {
|
|
1469
1325
|
type: "summary",
|
|
1470
1326
|
value: e.obj.id
|
|
@@ -1479,7 +1335,7 @@ const $n = function(e) {
|
|
|
1479
1335
|
value: [e.obj.id]
|
|
1480
1336
|
};
|
|
1481
1337
|
};
|
|
1482
|
-
function
|
|
1338
|
+
function On(e) {
|
|
1483
1339
|
let t = [], n = -1, o = e.getData(), s = [];
|
|
1484
1340
|
e.undo = function() {
|
|
1485
1341
|
if (n > -1) {
|
|
@@ -1502,6 +1358,8 @@ function jn(e) {
|
|
|
1502
1358
|
} catch {
|
|
1503
1359
|
}
|
|
1504
1360
|
}
|
|
1361
|
+
}, e.clearHistory = function() {
|
|
1362
|
+
t = [], n = -1, o = e.getData(), e.clearSelection();
|
|
1505
1363
|
};
|
|
1506
1364
|
const i = function(r) {
|
|
1507
1365
|
if (r.name === "beginEdit") return;
|
|
@@ -1510,7 +1368,7 @@ function jn(e) {
|
|
|
1510
1368
|
prev: o,
|
|
1511
1369
|
operation: r.name,
|
|
1512
1370
|
currentSelected: s.map((h) => h.id),
|
|
1513
|
-
currentTarget:
|
|
1371
|
+
currentTarget: Pn(r),
|
|
1514
1372
|
next: a
|
|
1515
1373
|
};
|
|
1516
1374
|
t.push(d), o = a, n = t.length - 1;
|
|
@@ -1523,34 +1381,34 @@ function jn(e) {
|
|
|
1523
1381
|
e.bus.removeListener("operation", i), e.bus.removeListener("selectNodes", c), e.container.removeEventListener("keydown", l);
|
|
1524
1382
|
};
|
|
1525
1383
|
}
|
|
1526
|
-
const
|
|
1527
|
-
side:
|
|
1528
|
-
left:
|
|
1529
|
-
right:
|
|
1530
|
-
full:
|
|
1531
|
-
living:
|
|
1532
|
-
zoomin:
|
|
1533
|
-
zoomout:
|
|
1534
|
-
},
|
|
1384
|
+
const $n = '<?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>', Hn = '<?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>', jn = '<?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>', In = '<?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>', Rn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="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>', Bn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="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>', Yn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="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>', Wn = {
|
|
1385
|
+
side: $n,
|
|
1386
|
+
left: Hn,
|
|
1387
|
+
right: jn,
|
|
1388
|
+
full: In,
|
|
1389
|
+
living: Rn,
|
|
1390
|
+
zoomin: Bn,
|
|
1391
|
+
zoomout: Yn
|
|
1392
|
+
}, G = (e, t) => {
|
|
1535
1393
|
const n = document.createElement("span");
|
|
1536
|
-
return n.id = e, n.innerHTML =
|
|
1394
|
+
return n.id = e, n.innerHTML = Wn[t], n;
|
|
1537
1395
|
};
|
|
1538
|
-
function
|
|
1539
|
-
const t = document.createElement("div"), n =
|
|
1396
|
+
function Xn(e) {
|
|
1397
|
+
const t = document.createElement("div"), n = G("fullscreen", "full"), o = G("toCenter", "living"), s = G("zoomout", "zoomout"), i = G("zoomin", "zoomin");
|
|
1540
1398
|
t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb";
|
|
1541
1399
|
let l = null;
|
|
1542
1400
|
const c = () => {
|
|
1543
|
-
const a = e.container.getBoundingClientRect(), d = Se(e.map.style.transform), h = a.width / 2, u = a.height / 2, y = (h - d.x) / e.scaleVal,
|
|
1401
|
+
const a = e.container.getBoundingClientRect(), d = Se(e.map.style.transform), h = a.width / 2, u = a.height / 2, y = (h - d.x) / e.scaleVal, b = (u - d.y) / e.scaleVal;
|
|
1544
1402
|
l = {
|
|
1545
1403
|
containerRect: a,
|
|
1546
1404
|
currentTransform: d,
|
|
1547
1405
|
mapCenterX: y,
|
|
1548
|
-
mapCenterY:
|
|
1406
|
+
mapCenterY: b
|
|
1549
1407
|
};
|
|
1550
1408
|
}, r = () => {
|
|
1551
1409
|
if (l) {
|
|
1552
|
-
const a = e.container.getBoundingClientRect(), d = a.width / 2, h = a.height / 2, u = d - l.mapCenterX * e.scaleVal, y = h - l.mapCenterY * e.scaleVal,
|
|
1553
|
-
e.move(
|
|
1410
|
+
const a = e.container.getBoundingClientRect(), d = a.width / 2, h = a.height / 2, u = d - l.mapCenterX * e.scaleVal, y = h - l.mapCenterY * e.scaleVal, b = u - l.currentTransform.x, p = y - l.currentTransform.y;
|
|
1411
|
+
e.move(b, p);
|
|
1554
1412
|
}
|
|
1555
1413
|
};
|
|
1556
1414
|
return e.el.addEventListener("fullscreenchange", r), n.onclick = () => {
|
|
@@ -1563,8 +1421,8 @@ function zn(e) {
|
|
|
1563
1421
|
e.scale(e.scaleVal + e.scaleSensitivity);
|
|
1564
1422
|
}, t;
|
|
1565
1423
|
}
|
|
1566
|
-
function
|
|
1567
|
-
const t = document.createElement("div"), n =
|
|
1424
|
+
function Fn(e) {
|
|
1425
|
+
const t = document.createElement("div"), n = G("tbltl", "left"), o = G("tbltr", "right"), s = G("tblts", "side");
|
|
1568
1426
|
return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
1569
1427
|
e.initLeft();
|
|
1570
1428
|
}, o.onclick = () => {
|
|
@@ -1573,10 +1431,10 @@ function Gn(e) {
|
|
|
1573
1431
|
e.initSide();
|
|
1574
1432
|
}, t;
|
|
1575
1433
|
}
|
|
1576
|
-
function
|
|
1577
|
-
e.container.append(
|
|
1434
|
+
function Gn(e) {
|
|
1435
|
+
e.container.append(Xn(e)), e.container.append(Fn(e));
|
|
1578
1436
|
}
|
|
1579
|
-
class
|
|
1437
|
+
class Vn {
|
|
1580
1438
|
_listeners = /* @__PURE__ */ new Map();
|
|
1581
1439
|
addEventListener(t, n) {
|
|
1582
1440
|
const o = this._listeners.get(t) ?? /* @__PURE__ */ new Set();
|
|
@@ -1599,15 +1457,15 @@ class qn {
|
|
|
1599
1457
|
off = this.removeEventListener;
|
|
1600
1458
|
emit = this.dispatchEvent;
|
|
1601
1459
|
}
|
|
1602
|
-
const
|
|
1460
|
+
const Be = (e, t = "px") => typeof e == "number" ? e + t : e, Y = ({ style: e }, t, n) => {
|
|
1603
1461
|
if (typeof t == "object")
|
|
1604
1462
|
for (const [o, s] of Object.entries(t))
|
|
1605
|
-
s !== void 0 && (e[o] =
|
|
1606
|
-
else n !== void 0 && (e[t] =
|
|
1607
|
-
},
|
|
1463
|
+
s !== void 0 && (e[o] = Be(s));
|
|
1464
|
+
else n !== void 0 && (e[t] = Be(n));
|
|
1465
|
+
}, Ye = (e = 0, t = 0, n = 0, o = 0) => {
|
|
1608
1466
|
const s = { x: e, y: t, width: n, height: o, top: t, left: e, right: e + n, bottom: t + o };
|
|
1609
1467
|
return { ...s, toJSON: () => JSON.stringify(s) };
|
|
1610
|
-
},
|
|
1468
|
+
}, zn = (e) => {
|
|
1611
1469
|
let t, n = -1, o = !1;
|
|
1612
1470
|
return {
|
|
1613
1471
|
next: (...s) => {
|
|
@@ -1619,7 +1477,7 @@ const Ye = (e, t = "px") => typeof e == "number" ? e + t : e, F = ({ style: e },
|
|
|
1619
1477
|
cancelAnimationFrame(n), o = !1;
|
|
1620
1478
|
}
|
|
1621
1479
|
};
|
|
1622
|
-
},
|
|
1480
|
+
}, We = (e, t, n = "touch") => {
|
|
1623
1481
|
switch (n) {
|
|
1624
1482
|
case "center": {
|
|
1625
1483
|
const o = t.left + t.width / 2, s = t.top + t.height / 2;
|
|
@@ -1630,16 +1488,16 @@ const Ye = (e, t = "px") => typeof e == "number" ? e + t : e, F = ({ style: e },
|
|
|
1630
1488
|
case "touch":
|
|
1631
1489
|
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
|
|
1632
1490
|
}
|
|
1633
|
-
},
|
|
1634
|
-
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n =
|
|
1491
|
+
}, Kn = () => matchMedia("(hover: none), (pointer: coarse)").matches, qn = () => "safari" in window, be = (e) => Array.isArray(e) ? e : [e], at = (e) => (t, n, o, s = {}) => {
|
|
1492
|
+
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = be(n), t = be(t);
|
|
1635
1493
|
for (const i of t)
|
|
1636
1494
|
if (i)
|
|
1637
1495
|
for (const l of n)
|
|
1638
1496
|
i[e](l, o, { capture: !1, ...s });
|
|
1639
|
-
},
|
|
1497
|
+
}, W = at("addEventListener"), $ = at("removeEventListener"), ne = (e) => {
|
|
1640
1498
|
const { clientX: t, clientY: n, target: o } = e.touches?.[0] ?? e;
|
|
1641
1499
|
return { x: t, y: n, target: o };
|
|
1642
|
-
},
|
|
1500
|
+
}, K = (e, t = document) => be(e).map((n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null).flat().filter(Boolean), Un = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
|
|
1643
1501
|
switch (o) {
|
|
1644
1502
|
case "alt":
|
|
1645
1503
|
return e.altKey;
|
|
@@ -1648,18 +1506,18 @@ const Ye = (e, t = "px") => typeof e == "number" ? e + t : e, F = ({ style: e },
|
|
|
1648
1506
|
case "shift":
|
|
1649
1507
|
return e.shiftKey;
|
|
1650
1508
|
}
|
|
1651
|
-
}) : !1), { abs:
|
|
1509
|
+
}) : !1), { abs: F, max: Xe, min: Fe, ceil: Ge } = Math, Ve = (e = []) => ({
|
|
1652
1510
|
stored: e,
|
|
1653
1511
|
selected: [],
|
|
1654
1512
|
touched: [],
|
|
1655
1513
|
changed: { added: [], removed: [] }
|
|
1656
1514
|
});
|
|
1657
|
-
class
|
|
1515
|
+
class Jn extends Vn {
|
|
1658
1516
|
static version = "mind-elixir-fork";
|
|
1659
1517
|
// Options
|
|
1660
1518
|
_options;
|
|
1661
1519
|
// Selection store
|
|
1662
|
-
_selection =
|
|
1520
|
+
_selection = Ve();
|
|
1663
1521
|
// Area element and clipping element
|
|
1664
1522
|
_area;
|
|
1665
1523
|
_clippingElement;
|
|
@@ -1672,7 +1530,7 @@ class Qn extends qn {
|
|
|
1672
1530
|
_latestElement;
|
|
1673
1531
|
// Dynamically constructed area rect
|
|
1674
1532
|
_areaLocation = { y1: 0, x2: 0, y2: 0, x1: 0 };
|
|
1675
|
-
_areaRect =
|
|
1533
|
+
_areaRect = Ye();
|
|
1676
1534
|
// If a single click is being performed, it's a single-click until the user dragged the mouse
|
|
1677
1535
|
_singleClick = !0;
|
|
1678
1536
|
_frame;
|
|
@@ -1727,38 +1585,38 @@ class Qn extends qn {
|
|
|
1727
1585
|
for (const i of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
|
1728
1586
|
typeof this[i] == "function" && (this[i] = this[i].bind(this));
|
|
1729
1587
|
const { document: n, selectionAreaClass: o, selectionContainerClass: s } = this._options;
|
|
1730
|
-
this._area = n.createElement("div"), this._clippingElement = n.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(o), s && this._clippingElement.classList.add(s),
|
|
1588
|
+
this._area = n.createElement("div"), this._clippingElement = n.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(o), s && this._clippingElement.classList.add(s), Y(this._area, {
|
|
1731
1589
|
willChange: "top, left, bottom, right, width, height",
|
|
1732
1590
|
top: 0,
|
|
1733
1591
|
left: 0,
|
|
1734
1592
|
position: "fixed"
|
|
1735
|
-
}),
|
|
1593
|
+
}), Y(this._clippingElement, {
|
|
1736
1594
|
overflow: "hidden",
|
|
1737
1595
|
position: "fixed",
|
|
1738
1596
|
transform: "translate3d(0, 0, 0)",
|
|
1739
1597
|
// https://stackoverflow.com/a/38268846
|
|
1740
1598
|
pointerEvents: "none",
|
|
1741
1599
|
zIndex: "1"
|
|
1742
|
-
}), this._frame =
|
|
1600
|
+
}), this._frame = zn((i) => {
|
|
1743
1601
|
this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", i), this._redrawSelectionArea();
|
|
1744
1602
|
}), this.enable();
|
|
1745
1603
|
}
|
|
1746
1604
|
_toggleStartEvents(t = !0) {
|
|
1747
|
-
const { document: n, features: o } = this._options, s = t ?
|
|
1605
|
+
const { document: n, features: o } = this._options, s = t ? W : $;
|
|
1748
1606
|
s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, { passive: !1 });
|
|
1749
1607
|
}
|
|
1750
1608
|
_onTapStart(t, n = !1) {
|
|
1751
1609
|
const { x: o, y: s, target: i } = ne(t), { document: l, startAreas: c, boundaries: r, features: a, behaviour: d } = this._options, h = i.getBoundingClientRect();
|
|
1752
|
-
if (t instanceof MouseEvent && !
|
|
1610
|
+
if (t instanceof MouseEvent && !Un(t, d.triggers))
|
|
1753
1611
|
return;
|
|
1754
|
-
const u =
|
|
1755
|
-
this._targetElement = y.find((m) =>
|
|
1756
|
-
const
|
|
1757
|
-
if (this._targetBoundary = y.find((m) =>
|
|
1612
|
+
const u = K(c, l), y = K(r, l);
|
|
1613
|
+
this._targetElement = y.find((m) => We(m.getBoundingClientRect(), h));
|
|
1614
|
+
const b = t.composedPath(), p = u.find((m) => b.includes(m));
|
|
1615
|
+
if (this._targetBoundary = y.find((m) => b.includes(m)), !this._targetElement || !p || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1758
1616
|
return;
|
|
1759
1617
|
this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
|
|
1760
1618
|
const g = l.scrollingElement ?? l.body;
|
|
1761
|
-
this._scrollDelta = { x: g.scrollLeft, y: g.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0),
|
|
1619
|
+
this._scrollDelta = { x: g.scrollLeft, y: g.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), W(l, ["touchmove", "mousemove"], this._delayedTapMove, { passive: !1 }), W(l, ["mouseup", "touchcancel", "touchend"], this._onTapStop), W(l, "scroll", this._onScroll), a.deselectOnBlur && (this._targetBoundaryScrolled = !1, W(this._targetBoundary, "scroll", this._onStartAreaScroll));
|
|
1762
1620
|
}
|
|
1763
1621
|
_onSingleTap(t) {
|
|
1764
1622
|
const {
|
|
@@ -1803,33 +1661,33 @@ class Qn extends qn {
|
|
|
1803
1661
|
} = this._options, { x1: i, y1: l } = this._areaLocation, { x: c, y: r } = ne(t);
|
|
1804
1662
|
if (
|
|
1805
1663
|
// Single number for both coordinates
|
|
1806
|
-
typeof s == "number" &&
|
|
1807
|
-
typeof s == "object" &&
|
|
1664
|
+
typeof s == "number" && F(c + r - (i + l)) >= s || // Different x and y threshold
|
|
1665
|
+
typeof s == "object" && F(c - i) >= s.x || F(r - l) >= s.y
|
|
1808
1666
|
) {
|
|
1809
1667
|
if ($(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1810
1668
|
$(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
|
|
1811
1669
|
return;
|
|
1812
1670
|
}
|
|
1813
|
-
|
|
1671
|
+
W(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), Y(this._area, "display", "block"), K(n, o)[0].appendChild(this._clippingElement), this.resolveSelectables(), this._singleClick = !1, this._targetRect = this._targetElement.getBoundingClientRect(), this._scrollAvailable = this._targetElement.scrollHeight !== this._targetElement.clientHeight || this._targetElement.scrollWidth !== this._targetElement.clientWidth, this._scrollAvailable && (W(this._targetElement, "wheel", this._wheelScroll, { passive: !1 }), W(this._options.document, "keydown", this._keyboardScroll, { passive: !1 }), this._selectables = this._selectables.filter((a) => this._targetElement.contains(a))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
|
|
1814
1672
|
}
|
|
1815
1673
|
this._handleMoveEvent(t);
|
|
1816
1674
|
}
|
|
1817
1675
|
_setupSelectionArea() {
|
|
1818
1676
|
const { _clippingElement: t, _targetElement: n, _area: o } = this, s = this._targetRect = n.getBoundingClientRect();
|
|
1819
|
-
this._scrollAvailable ? (
|
|
1677
|
+
this._scrollAvailable ? (Y(t, {
|
|
1820
1678
|
top: s.top,
|
|
1821
1679
|
left: s.left,
|
|
1822
1680
|
width: s.width,
|
|
1823
1681
|
height: s.height
|
|
1824
|
-
}),
|
|
1682
|
+
}), Y(o, {
|
|
1825
1683
|
marginTop: -s.top,
|
|
1826
1684
|
marginLeft: -s.left
|
|
1827
|
-
})) : (
|
|
1685
|
+
})) : (Y(t, {
|
|
1828
1686
|
top: 0,
|
|
1829
1687
|
left: 0,
|
|
1830
1688
|
width: "100%",
|
|
1831
1689
|
height: "100%"
|
|
1832
|
-
}),
|
|
1690
|
+
}), Y(o, {
|
|
1833
1691
|
marginTop: 0,
|
|
1834
1692
|
marginLeft: 0
|
|
1835
1693
|
}));
|
|
@@ -1847,7 +1705,7 @@ class Qn extends qn {
|
|
|
1847
1705
|
}
|
|
1848
1706
|
const d = this._options.mindElixirInstance;
|
|
1849
1707
|
if (d && d.move) {
|
|
1850
|
-
const h = n.x ?
|
|
1708
|
+
const h = n.x ? Ge(n.x / l) : 0, u = n.y ? Ge(n.y / l) : 0;
|
|
1851
1709
|
(h || u) && (d.move(-h, -u), o.x1 -= h, o.y1 -= u);
|
|
1852
1710
|
}
|
|
1853
1711
|
i.next(t), requestAnimationFrame(a);
|
|
@@ -1859,7 +1717,7 @@ class Qn extends qn {
|
|
|
1859
1717
|
}
|
|
1860
1718
|
_handleMoveEvent(t) {
|
|
1861
1719
|
const { features: n } = this._options;
|
|
1862
|
-
(n.touch &&
|
|
1720
|
+
(n.touch && Kn() || this._scrollAvailable && qn()) && t.preventDefault();
|
|
1863
1721
|
}
|
|
1864
1722
|
_onScroll() {
|
|
1865
1723
|
const {
|
|
@@ -1892,9 +1750,9 @@ class Qn extends qn {
|
|
|
1892
1750
|
scrolling: { startScrollMargins: d }
|
|
1893
1751
|
}
|
|
1894
1752
|
} = s;
|
|
1895
|
-
r < i.left + d.x ? (t.x = -
|
|
1896
|
-
const h =
|
|
1897
|
-
this._areaRect =
|
|
1753
|
+
r < i.left + d.x ? (t.x = -F(i.left - r + d.x), r = r < i.left ? i.left : r) : r > i.right - d.x ? (t.x = F(i.left + i.width - r - d.x), r = r > i.right ? i.right : r) : t.x = 0, a < i.top + d.y ? (t.y = -F(i.top - a + d.y), a = a < i.top ? i.top : a) : a > i.bottom - d.y ? (t.y = F(i.top + i.height - a - d.y), a = a > i.bottom ? i.bottom : a) : t.y = 0;
|
|
1754
|
+
const h = Fe(l, r), u = Fe(c, a), y = Xe(l, r), b = Xe(c, a);
|
|
1755
|
+
this._areaRect = Ye(h, u, y - h, b - u);
|
|
1898
1756
|
}
|
|
1899
1757
|
_redrawSelectionArea() {
|
|
1900
1758
|
const { x: t, y: n, width: o, height: s } = this._areaRect, { style: i } = this._area;
|
|
@@ -1902,13 +1760,13 @@ class Qn extends qn {
|
|
|
1902
1760
|
}
|
|
1903
1761
|
_onTapStop(t, n) {
|
|
1904
1762
|
const { document: o, features: s } = this._options, { _singleClick: i } = this;
|
|
1905
|
-
$(this._targetElement, "scroll", this._onStartAreaScroll), $(o, ["mousemove", "touchmove"], this._delayedTapMove), $(o, ["touchmove", "mousemove"], this._onTapMove), $(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop), $(o, "scroll", this._onScroll), this._keepSelection(), t && i && s.singleTap.allow ? this._onSingleTap(t) : !i && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, $(this._targetElement, "wheel", this._wheelScroll, { passive: !0 }), $(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), this._frame?.cancel(),
|
|
1763
|
+
$(this._targetElement, "scroll", this._onStartAreaScroll), $(o, ["mousemove", "touchmove"], this._delayedTapMove), $(o, ["touchmove", "mousemove"], this._onTapMove), $(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop), $(o, "scroll", this._onScroll), this._keepSelection(), t && i && s.singleTap.allow ? this._onSingleTap(t) : !i && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, $(this._targetElement, "wheel", this._wheelScroll, { passive: !0 }), $(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), this._frame?.cancel(), Y(this._area, "display", "none");
|
|
1906
1764
|
}
|
|
1907
1765
|
_updateElementSelection() {
|
|
1908
1766
|
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: c } = o, { intersect: r, overlap: a } = n.behaviour, d = a === "invert", h = [], u = [], y = [];
|
|
1909
1767
|
for (let p = 0; p < t.length; p++) {
|
|
1910
1768
|
const g = t[p];
|
|
1911
|
-
if (
|
|
1769
|
+
if (We(s, g.getBoundingClientRect(), r)) {
|
|
1912
1770
|
if (l.includes(g))
|
|
1913
1771
|
i.includes(g) && !c.includes(g) && c.push(g);
|
|
1914
1772
|
else if (d && i.includes(g)) {
|
|
@@ -1920,12 +1778,12 @@ class Qn extends qn {
|
|
|
1920
1778
|
}
|
|
1921
1779
|
}
|
|
1922
1780
|
d && u.push(...i.filter((p) => !l.includes(p)));
|
|
1923
|
-
const
|
|
1781
|
+
const b = a === "keep";
|
|
1924
1782
|
for (let p = 0; p < l.length; p++) {
|
|
1925
1783
|
const g = l[p];
|
|
1926
1784
|
!h.includes(g) && !// Check if the user wants to keep previously selected elements, e.g.,
|
|
1927
1785
|
// not make them part of the current selection as soon as they're touched.
|
|
1928
|
-
(
|
|
1786
|
+
(b && i.includes(g)) && y.push(g);
|
|
1929
1787
|
}
|
|
1930
1788
|
o.selected = h, o.changed = { added: u, removed: y }, this._latestElement = void 0;
|
|
1931
1789
|
}
|
|
@@ -1978,7 +1836,7 @@ class Qn extends qn {
|
|
|
1978
1836
|
* Will update everything that can be selected
|
|
1979
1837
|
*/
|
|
1980
1838
|
resolveSelectables() {
|
|
1981
|
-
this._selectables =
|
|
1839
|
+
this._selectables = K(this._options.selectables, this._options.document);
|
|
1982
1840
|
}
|
|
1983
1841
|
/**
|
|
1984
1842
|
* Same as deselecting, but for all elements currently selected
|
|
@@ -1987,7 +1845,7 @@ class Qn extends qn {
|
|
|
1987
1845
|
*/
|
|
1988
1846
|
clearSelection(t = !0, n = !1) {
|
|
1989
1847
|
const { selected: o, stored: s, changed: i } = this._selection;
|
|
1990
|
-
i.added = [], i.removed.push(...o, ...t ? s : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection =
|
|
1848
|
+
i.added = [], i.removed.push(...o, ...t ? s : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Ve(t ? [] : s);
|
|
1991
1849
|
}
|
|
1992
1850
|
/**
|
|
1993
1851
|
* @returns {Array} Selected elements
|
|
@@ -2047,7 +1905,7 @@ class Qn extends qn {
|
|
|
2047
1905
|
* @param quiet If this should not trigger the move event
|
|
2048
1906
|
*/
|
|
2049
1907
|
select(t, n = !1) {
|
|
2050
|
-
const { changed: o, selected: s, stored: i } = this._selection, l =
|
|
1908
|
+
const { changed: o, selected: s, stored: i } = this._selection, l = K(t, this._options.document).filter((c) => !s.includes(c) && !i.includes(c));
|
|
2051
1909
|
return i.push(...l), s.push(...l), o.added.push(...l), o.removed = [], this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)), l;
|
|
2052
1910
|
}
|
|
2053
1911
|
/**
|
|
@@ -2056,12 +1914,12 @@ class Qn extends qn {
|
|
|
2056
1914
|
* @param quiet If this should not trigger the move event
|
|
2057
1915
|
*/
|
|
2058
1916
|
deselect(t, n = !1) {
|
|
2059
|
-
const { selected: o, stored: s, changed: i } = this._selection, l =
|
|
1917
|
+
const { selected: o, stored: s, changed: i } = this._selection, l = K(t, this._options.document).filter((c) => o.includes(c) || s.includes(c));
|
|
2060
1918
|
this._selection.stored = s.filter((c) => !l.includes(c)), this._selection.selected = o.filter((c) => !l.includes(c)), this._selection.changed.added = [], this._selection.changed.removed.push(...l.filter((c) => !i.removed.includes(c))), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null));
|
|
2061
1919
|
}
|
|
2062
1920
|
}
|
|
2063
|
-
function
|
|
2064
|
-
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new
|
|
1921
|
+
function Zn(e) {
|
|
1922
|
+
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new Jn({
|
|
2065
1923
|
selectables: [".map-container me-tpc"],
|
|
2066
1924
|
boundaries: [e.container],
|
|
2067
1925
|
container: e.selectionContainer,
|
|
@@ -2120,10 +1978,10 @@ function eo(e) {
|
|
|
2120
1978
|
);
|
|
2121
1979
|
e.selection = n;
|
|
2122
1980
|
}
|
|
2123
|
-
const
|
|
1981
|
+
const Qn = function(e, t = !0) {
|
|
2124
1982
|
this.theme = e;
|
|
2125
1983
|
const o = {
|
|
2126
|
-
...(e.type === "dark" ? we :
|
|
1984
|
+
...(e.type === "dark" ? we : ve).cssVar,
|
|
2127
1985
|
...e.cssVar
|
|
2128
1986
|
}, s = Object.keys(o);
|
|
2129
1987
|
for (let i = 0; i < s.length; i++) {
|
|
@@ -2131,7 +1989,7 @@ const to = function(e, t = !0) {
|
|
|
2131
1989
|
this.container.style.setProperty(l, o[l]);
|
|
2132
1990
|
}
|
|
2133
1991
|
t && this.refresh();
|
|
2134
|
-
},
|
|
1992
|
+
}, eo = function(e) {
|
|
2135
1993
|
return {
|
|
2136
1994
|
dom: e,
|
|
2137
1995
|
moved: !1,
|
|
@@ -2154,7 +2012,7 @@ const to = function(e, t = !0) {
|
|
|
2154
2012
|
},
|
|
2155
2013
|
cb: null,
|
|
2156
2014
|
init(t, n) {
|
|
2157
|
-
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy =
|
|
2015
|
+
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = Je([
|
|
2158
2016
|
{ dom: t, evt: "pointermove", func: this.handlePointerMove },
|
|
2159
2017
|
{ dom: t, evt: "pointerleave", func: this.handleClear },
|
|
2160
2018
|
{ dom: t, evt: "pointerup", func: this.handleClear },
|
|
@@ -2166,27 +2024,27 @@ const to = function(e, t = !0) {
|
|
|
2166
2024
|
this.moved = !1, this.pointerdown = !1;
|
|
2167
2025
|
}
|
|
2168
2026
|
};
|
|
2169
|
-
},
|
|
2170
|
-
create:
|
|
2171
|
-
},
|
|
2172
|
-
function
|
|
2027
|
+
}, ze = {
|
|
2028
|
+
create: eo
|
|
2029
|
+
}, to = "#4dc4ff";
|
|
2030
|
+
function dt(e, t, n, o, s, i, l, c) {
|
|
2173
2031
|
return {
|
|
2174
2032
|
x: e / 8 + n * 3 / 8 + s * 3 / 8 + l / 8,
|
|
2175
2033
|
y: t / 8 + o * 3 / 8 + i * 3 / 8 + c / 8
|
|
2176
2034
|
};
|
|
2177
2035
|
}
|
|
2178
|
-
function
|
|
2036
|
+
function no(e, t, n) {
|
|
2179
2037
|
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(), fe(e));
|
|
2180
2038
|
}
|
|
2181
2039
|
function oe(e, t, n, o, s) {
|
|
2182
|
-
|
|
2040
|
+
D(e, {
|
|
2183
2041
|
x1: t + "",
|
|
2184
2042
|
y1: n + "",
|
|
2185
2043
|
x2: o + "",
|
|
2186
2044
|
y2: s + ""
|
|
2187
2045
|
});
|
|
2188
2046
|
}
|
|
2189
|
-
function
|
|
2047
|
+
function Ke(e, t, n, o, s, i, l, c, r, a) {
|
|
2190
2048
|
const d = `M ${t} ${n} C ${o} ${s} ${i} ${l} ${c} ${r}`;
|
|
2191
2049
|
if (e.line.setAttribute("d", d), a.style) {
|
|
2192
2050
|
const p = a.style;
|
|
@@ -2212,15 +2070,15 @@ function Ue(e, t, n, o, s, i, l, c, r, a) {
|
|
|
2212
2070
|
}
|
|
2213
2071
|
}
|
|
2214
2072
|
}
|
|
2215
|
-
const { x: y, y:
|
|
2216
|
-
if (e.labelEl &&
|
|
2073
|
+
const { x: y, y: b } = dt(t, n, o, s, i, l, c, r);
|
|
2074
|
+
if (e.labelEl && no(e.labelEl, y, b), a.style?.labelColor) {
|
|
2217
2075
|
const p = e.labelEl;
|
|
2218
2076
|
p && (p.style.color = a.style.labelColor);
|
|
2219
2077
|
}
|
|
2220
|
-
|
|
2078
|
+
fo(e);
|
|
2221
2079
|
}
|
|
2222
2080
|
function de(e, t, n) {
|
|
2223
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
2081
|
+
const { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = t.offsetWidth, l = t.offsetHeight, c = o + i / 2, r = s + l / 2, a = c + n.x, d = r + n.y;
|
|
2224
2082
|
return {
|
|
2225
2083
|
w: i,
|
|
2226
2084
|
h: l,
|
|
@@ -2230,7 +2088,7 @@ function de(e, t, n) {
|
|
|
2230
2088
|
ctrlY: d
|
|
2231
2089
|
};
|
|
2232
2090
|
}
|
|
2233
|
-
function
|
|
2091
|
+
function q(e) {
|
|
2234
2092
|
let t, n;
|
|
2235
2093
|
const o = (e.cy - e.ctrlY) / (e.ctrlX - e.cx);
|
|
2236
2094
|
return o > e.h / e.w || o < -e.h / e.w ? e.cy - e.ctrlY < 0 ? (t = e.cx - e.h / 2 / o, n = e.cy + e.h / 2) : (t = e.cx + e.h / 2 / o, n = e.cy - e.h / 2) : e.cx - e.ctrlX < 0 ? (t = e.cx + e.w / 2, n = e.cy - e.w * o / 2) : (t = e.cx - e.w / 2, n = e.cy + e.w * o / 2), {
|
|
@@ -2238,68 +2096,68 @@ function K(e) {
|
|
|
2238
2096
|
y: n
|
|
2239
2097
|
};
|
|
2240
2098
|
}
|
|
2241
|
-
const
|
|
2242
|
-
const o =
|
|
2099
|
+
const oo = function(e, t, n) {
|
|
2100
|
+
const o = H(e.nodes, t), s = H(e.nodes, n), i = o.offsetLeft + t.offsetWidth / 2, l = o.offsetTop + t.offsetHeight / 2, c = s.offsetLeft + n.offsetWidth / 2, r = s.offsetTop + n.offsetHeight / 2, a = c - i, d = r - l, h = Math.sqrt(a * a + d * d), u = Math.max(50, Math.min(200, h * 0.3)), y = Math.abs(a), b = Math.abs(d);
|
|
2243
2101
|
let p, g;
|
|
2244
2102
|
if (h < 150) {
|
|
2245
|
-
const
|
|
2246
|
-
p = { x: 200 *
|
|
2247
|
-
} else if (y >
|
|
2248
|
-
const
|
|
2249
|
-
p = { x:
|
|
2250
|
-
} else if (
|
|
2251
|
-
const
|
|
2252
|
-
p = { x: 0, y:
|
|
2103
|
+
const v = t.closest("me-main").className === "lhs" ? -1 : 1;
|
|
2104
|
+
p = { x: 200 * v, y: 0 }, g = { x: 200 * v, y: 0 };
|
|
2105
|
+
} else if (y > b * 1.5) {
|
|
2106
|
+
const v = a > 0 ? t.offsetWidth / 2 : -t.offsetWidth / 2, E = a > 0 ? -n.offsetWidth / 2 : n.offsetWidth / 2;
|
|
2107
|
+
p = { x: v + (a > 0 ? u : -u), y: 0 }, g = { x: E + (a > 0 ? -u : u), y: 0 };
|
|
2108
|
+
} else if (b > y * 1.5) {
|
|
2109
|
+
const v = d > 0 ? t.offsetHeight / 2 : -t.offsetHeight / 2, E = d > 0 ? -n.offsetHeight / 2 : n.offsetHeight / 2;
|
|
2110
|
+
p = { x: 0, y: v + (d > 0 ? u : -u) }, g = { x: 0, y: E + (d > 0 ? -u : u) };
|
|
2253
2111
|
} else {
|
|
2254
|
-
const
|
|
2255
|
-
p = { x:
|
|
2112
|
+
const v = Math.atan2(d, a), E = t.offsetWidth / 2 * Math.cos(v), k = t.offsetHeight / 2 * Math.sin(v), _ = -(n.offsetWidth / 2) * Math.cos(v), C = -(n.offsetHeight / 2) * Math.sin(v), x = u * 0.7 * (a > 0 ? 1 : -1), N = u * 0.7 * (d > 0 ? 1 : -1);
|
|
2113
|
+
p = { x: E + x, y: k + N }, g = { x: _ - x, y: C - N };
|
|
2256
2114
|
}
|
|
2257
2115
|
return { delta1: p, delta2: g };
|
|
2258
|
-
},
|
|
2116
|
+
}, Ae = function(e, t, n, o, s) {
|
|
2259
2117
|
if (!t || !n)
|
|
2260
2118
|
return;
|
|
2261
2119
|
if (!o.delta1 || !o.delta2) {
|
|
2262
|
-
const
|
|
2263
|
-
o.delta1 =
|
|
2120
|
+
const S = oo(e, t, n);
|
|
2121
|
+
o.delta1 = S.delta1, o.delta2 = S.delta2;
|
|
2264
2122
|
}
|
|
2265
|
-
const i = de(e, t, o.delta1), l = de(e, n, o.delta2), { x: c, y: r } =
|
|
2123
|
+
const i = de(e, t, o.delta1), l = de(e, n, o.delta2), { x: c, y: r } = q(i), { ctrlX: a, ctrlY: d } = i, { ctrlX: h, ctrlY: u } = l, { x: y, y: b } = q(l), p = ce(h, u, y, b);
|
|
2266
2124
|
if (!p) return;
|
|
2267
|
-
const g = `M ${p.x1} ${p.y1} L ${y} ${
|
|
2125
|
+
const g = `M ${p.x1} ${p.y1} L ${y} ${b} L ${p.x2} ${p.y2}`;
|
|
2268
2126
|
let m = "";
|
|
2269
2127
|
if (o.bidirectional) {
|
|
2270
|
-
const
|
|
2271
|
-
if (!
|
|
2272
|
-
m = `M ${
|
|
2128
|
+
const S = ce(a, d, c, r);
|
|
2129
|
+
if (!S) return;
|
|
2130
|
+
m = `M ${S.x1} ${S.y1} L ${c} ${r} L ${S.x2} ${S.y2}`;
|
|
2273
2131
|
}
|
|
2274
|
-
const
|
|
2275
|
-
|
|
2276
|
-
const
|
|
2132
|
+
const v = Ln(`M ${c} ${r} C ${a} ${d} ${h} ${u} ${y} ${b}`, g, m, o.style), { x: E, y: k } = dt(c, r, a, d, h, u, y, b), _ = o.style?.labelColor || "rgb(235, 95, 82)", C = "arrow-" + o.id;
|
|
2133
|
+
v.id = C;
|
|
2134
|
+
const x = e.markdown ? e.markdown(o.label, o) : o.label, N = ye(x, E, k, {
|
|
2277
2135
|
anchor: "middle",
|
|
2278
|
-
color:
|
|
2136
|
+
color: _,
|
|
2279
2137
|
dataType: "arrow",
|
|
2280
|
-
svgId:
|
|
2138
|
+
svgId: C
|
|
2281
2139
|
});
|
|
2282
|
-
|
|
2283
|
-
},
|
|
2140
|
+
v.labelEl = N, v.arrowObj = o, v.dataset.linkid = o.id, e.labelContainer.appendChild(N), e.linkSvgGroup.appendChild(v), fe(N), s || (e.arrows.push(o), e.currentArrow = v, ht(e, o, i, l));
|
|
2141
|
+
}, so = function(e, t, n = {}) {
|
|
2284
2142
|
const o = {
|
|
2285
|
-
id:
|
|
2143
|
+
id: z(),
|
|
2286
2144
|
label: "Custom Link",
|
|
2287
2145
|
from: e.nodeObj.id,
|
|
2288
2146
|
to: t.nodeObj.id,
|
|
2289
2147
|
...n
|
|
2290
2148
|
};
|
|
2291
|
-
|
|
2149
|
+
Ae(this, e, t, o), this.bus.fire("operation", {
|
|
2292
2150
|
name: "createArrow",
|
|
2293
2151
|
obj: o
|
|
2294
2152
|
});
|
|
2295
|
-
},
|
|
2153
|
+
}, io = function(e) {
|
|
2296
2154
|
ue(this);
|
|
2297
|
-
const t = { ...e, id:
|
|
2298
|
-
|
|
2155
|
+
const t = { ...e, id: z() };
|
|
2156
|
+
Ae(this, this.findEle(t.from), this.findEle(t.to), t), this.bus.fire("operation", {
|
|
2299
2157
|
name: "createArrow",
|
|
2300
2158
|
obj: t
|
|
2301
2159
|
});
|
|
2302
|
-
},
|
|
2160
|
+
}, ro = function(e) {
|
|
2303
2161
|
let t;
|
|
2304
2162
|
if (e ? t = e : t = this.currentArrow, !t) return;
|
|
2305
2163
|
ue(this);
|
|
@@ -2310,15 +2168,15 @@ const io = function(e, t, n) {
|
|
|
2310
2168
|
id: n
|
|
2311
2169
|
}
|
|
2312
2170
|
});
|
|
2313
|
-
},
|
|
2171
|
+
}, lo = function(e) {
|
|
2314
2172
|
this.currentArrow = e;
|
|
2315
2173
|
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s = de(this, n, t.delta1), i = de(this, o, t.delta2);
|
|
2316
|
-
|
|
2317
|
-
},
|
|
2174
|
+
ht(this, t, s, i);
|
|
2175
|
+
}, co = function() {
|
|
2318
2176
|
ue(this), this.currentArrow = null;
|
|
2319
2177
|
}, ge = function(e, t) {
|
|
2320
|
-
const n = document.createElementNS(
|
|
2321
|
-
return
|
|
2178
|
+
const n = document.createElementNS(j, "path");
|
|
2179
|
+
return D(n, {
|
|
2322
2180
|
d: e,
|
|
2323
2181
|
stroke: t,
|
|
2324
2182
|
fill: "none",
|
|
@@ -2326,8 +2184,8 @@ const io = function(e, t, n) {
|
|
|
2326
2184
|
"stroke-linecap": "round",
|
|
2327
2185
|
"stroke-linejoin": "round"
|
|
2328
2186
|
}), n;
|
|
2329
|
-
},
|
|
2330
|
-
const n = document.createElementNS(
|
|
2187
|
+
}, ao = function(e, t) {
|
|
2188
|
+
const n = document.createElementNS(j, "g");
|
|
2331
2189
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
2332
2190
|
const o = ge(e.line.getAttribute("d"), t);
|
|
2333
2191
|
n.appendChild(o);
|
|
@@ -2337,59 +2195,59 @@ const io = function(e, t, n) {
|
|
|
2337
2195
|
n.appendChild(i);
|
|
2338
2196
|
}
|
|
2339
2197
|
e.insertBefore(n, e.firstChild);
|
|
2340
|
-
},
|
|
2198
|
+
}, ho = function(e) {
|
|
2341
2199
|
const t = e.querySelector(".arrow-highlight");
|
|
2342
2200
|
t && t.remove();
|
|
2343
|
-
},
|
|
2201
|
+
}, fo = function(e) {
|
|
2344
2202
|
const t = e.querySelector(".arrow-highlight");
|
|
2345
2203
|
if (!t) return;
|
|
2346
2204
|
const n = t.querySelectorAll("path");
|
|
2347
2205
|
n.length >= 1 && n[0].setAttribute("d", e.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", e.arrow1.getAttribute("d")), n.length >= 3 && e.arrow2.getAttribute("d") && n[2].setAttribute("d", e.arrow2.getAttribute("d"));
|
|
2348
2206
|
}, ue = function(e) {
|
|
2349
|
-
e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow &&
|
|
2350
|
-
},
|
|
2207
|
+
e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && ho(e.currentArrow);
|
|
2208
|
+
}, ht = function(e, t, n, o) {
|
|
2351
2209
|
const { linkController: s, P2: i, P3: l, line1: c, line2: r, nodes: a, map: d, currentArrow: h, bus: u } = e;
|
|
2352
2210
|
if (!h) return;
|
|
2353
|
-
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l),
|
|
2354
|
-
let { x: y, y:
|
|
2355
|
-
i.style.cssText = `top:${g}px;left:${p}px;`, l.style.cssText = `top:${
|
|
2356
|
-
p = p +
|
|
2357
|
-
const
|
|
2358
|
-
y =
|
|
2359
|
-
}), e.helper2.init(d, (
|
|
2360
|
-
m = m +
|
|
2361
|
-
const
|
|
2362
|
-
|
|
2211
|
+
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l), ao(h, to);
|
|
2212
|
+
let { x: y, y: b } = q(n), { ctrlX: p, ctrlY: g } = n, { ctrlX: m, ctrlY: v } = o, { x: E, y: k } = q(o);
|
|
2213
|
+
i.style.cssText = `top:${g}px;left:${p}px;`, l.style.cssText = `top:${v}px;left:${m}px;`, oe(c, y, b, p, g), oe(r, m, v, E, k), e.helper1 = ze.create(i), e.helper2 = ze.create(l), e.helper1.init(d, (_, C) => {
|
|
2214
|
+
p = p + _ / e.scaleVal, g = g + C / e.scaleVal;
|
|
2215
|
+
const x = q({ ...n, ctrlX: p, ctrlY: g });
|
|
2216
|
+
y = x.x, b = x.y, i.style.top = g + "px", i.style.left = p + "px", Ke(h, y, b, p, g, m, v, E, k, t), oe(c, y, b, p, g), t.delta1.x = p - n.cx, t.delta1.y = g - n.cy, u.fire("updateArrowDelta", t);
|
|
2217
|
+
}), e.helper2.init(d, (_, C) => {
|
|
2218
|
+
m = m + _ / e.scaleVal, v = v + C / e.scaleVal;
|
|
2219
|
+
const x = q({ ...o, ctrlX: m, ctrlY: v });
|
|
2220
|
+
E = x.x, k = x.y, l.style.top = v + "px", l.style.left = m + "px", Ke(h, y, b, p, g, m, v, E, k, t), oe(r, m, v, E, k), t.delta2.x = m - o.cx, t.delta2.y = v - o.cy, u.fire("updateArrowDelta", t);
|
|
2363
2221
|
});
|
|
2364
2222
|
};
|
|
2365
|
-
function
|
|
2223
|
+
function uo() {
|
|
2366
2224
|
this.linkSvgGroup.innerHTML = "", this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach((t) => t.remove());
|
|
2367
2225
|
for (let t = 0; t < this.arrows.length; t++) {
|
|
2368
2226
|
const n = this.arrows[t];
|
|
2369
2227
|
try {
|
|
2370
|
-
|
|
2228
|
+
Ae(this, this.findEle(n.from), this.findEle(n.to), n, !0);
|
|
2371
2229
|
} catch {
|
|
2372
2230
|
}
|
|
2373
2231
|
}
|
|
2374
2232
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
2375
2233
|
}
|
|
2376
|
-
function
|
|
2377
|
-
ue(this), e && e.labelEl &&
|
|
2234
|
+
function po(e) {
|
|
2235
|
+
ue(this), e && e.labelEl && lt(this, e.labelEl, e.arrowObj);
|
|
2378
2236
|
}
|
|
2379
|
-
function
|
|
2237
|
+
function go() {
|
|
2380
2238
|
this.arrows = this.arrows.filter((e) => le(e.from, this.nodeData) && le(e.to, this.nodeData));
|
|
2381
2239
|
}
|
|
2382
|
-
const
|
|
2240
|
+
const mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2383
2241
|
__proto__: null,
|
|
2384
|
-
createArrow:
|
|
2385
|
-
createArrowFrom:
|
|
2386
|
-
editArrowLabel:
|
|
2387
|
-
removeArrow:
|
|
2388
|
-
renderArrow:
|
|
2389
|
-
selectArrow:
|
|
2390
|
-
tidyArrow:
|
|
2391
|
-
unselectArrow:
|
|
2392
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2242
|
+
createArrow: so,
|
|
2243
|
+
createArrowFrom: io,
|
|
2244
|
+
editArrowLabel: po,
|
|
2245
|
+
removeArrow: ro,
|
|
2246
|
+
renderArrow: uo,
|
|
2247
|
+
selectArrow: lo,
|
|
2248
|
+
tidyArrow: go,
|
|
2249
|
+
unselectArrow: co
|
|
2250
|
+
}, Symbol.toStringTag, { value: "Module" })), yo = function(e) {
|
|
2393
2251
|
if (e.length === 0) throw new Error("No selected node.");
|
|
2394
2252
|
if (e.length === 1) {
|
|
2395
2253
|
const r = e[0].nodeObj, a = e[0].nodeObj.parent;
|
|
@@ -2426,101 +2284,101 @@ const vo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2426
2284
|
start: i,
|
|
2427
2285
|
end: l
|
|
2428
2286
|
};
|
|
2429
|
-
},
|
|
2430
|
-
const t = document.createElementNS(
|
|
2287
|
+
}, bo = function(e) {
|
|
2288
|
+
const t = document.createElementNS(j, "g");
|
|
2431
2289
|
return t.setAttribute("id", e), t;
|
|
2432
|
-
},
|
|
2433
|
-
const n = document.createElementNS(
|
|
2434
|
-
return
|
|
2290
|
+
}, qe = function(e, t) {
|
|
2291
|
+
const n = document.createElementNS(j, "path");
|
|
2292
|
+
return D(n, {
|
|
2435
2293
|
d: e,
|
|
2436
2294
|
stroke: t || "#666",
|
|
2437
2295
|
fill: "none",
|
|
2438
2296
|
"stroke-linecap": "round",
|
|
2439
2297
|
"stroke-width": "2"
|
|
2440
2298
|
}), n;
|
|
2441
|
-
},
|
|
2299
|
+
}, vo = (e) => e.parentElement.parentElement, wo = function(e, { parent: t, start: n }) {
|
|
2442
2300
|
const o = e.findEle(t), s = o.nodeObj;
|
|
2443
2301
|
let i;
|
|
2444
2302
|
return s.parent ? i = o.closest("me-main").className : i = e.findEle(s.children[n].id).closest("me-main").className, i;
|
|
2445
2303
|
}, Me = function(e, t) {
|
|
2446
|
-
const { id: n, label: o, parent: s, start: i, end: l, style: c } = t, { nodes: r, theme: a, summarySvg: d } = e, u = e.findEle(s).nodeObj, y =
|
|
2447
|
-
let
|
|
2304
|
+
const { id: n, label: o, parent: s, start: i, end: l, style: c } = t, { nodes: r, theme: a, summarySvg: d } = e, u = e.findEle(s).nodeObj, y = wo(e, t);
|
|
2305
|
+
let b = 1 / 0, p = 0, g = 0, m = 0;
|
|
2448
2306
|
for (let f = i; f <= l; f++) {
|
|
2449
2307
|
const w = u.children?.[f];
|
|
2450
2308
|
if (!w)
|
|
2451
2309
|
return e.removeSummary(n), null;
|
|
2452
|
-
const
|
|
2453
|
-
f === i && (g =
|
|
2454
|
-
}
|
|
2455
|
-
let
|
|
2456
|
-
const
|
|
2457
|
-
y === B.LHS ? (
|
|
2458
|
-
const R =
|
|
2459
|
-
return R.appendChild(
|
|
2460
|
-
},
|
|
2310
|
+
const T = vo(e.findEle(w.id)), { offsetLeft: O, offsetTop: X } = H(r, T), M = i === l ? 10 : 20;
|
|
2311
|
+
f === i && (g = X + M), f === l && (m = X + T.offsetHeight - M), O < b && (b = O), T.offsetWidth + O > p && (p = T.offsetWidth + O);
|
|
2312
|
+
}
|
|
2313
|
+
let v, E;
|
|
2314
|
+
const k = u.parent ? 10 : 0, _ = g + k, C = m + k, x = (_ + C) / 2, N = c?.stroke || a.cssVar["--color"], S = c?.labelColor || a.cssVar["--color"], A = "s-" + n, L = e.markdown ? e.markdown(o, t) : o;
|
|
2315
|
+
y === B.LHS ? (v = qe(`M ${b + 10} ${_} c -5 0 -10 5 -10 10 L ${b} ${C - 10} c 0 5 5 10 10 10 M ${b} ${x} h -10`, N), E = ye(L, b - 20, x, { anchor: "end", color: S, dataType: "summary", svgId: A })) : (v = qe(`M ${p - 10} ${_} c 5 0 10 5 10 10 L ${p} ${C - 10} c 0 5 -5 10 -10 10 M ${p} ${x} h 10`, N), E = ye(L, p + 20, x, { anchor: "start", color: S, dataType: "summary", svgId: A }));
|
|
2316
|
+
const R = bo(A);
|
|
2317
|
+
return R.appendChild(v), e.labelContainer.appendChild(E), fe(E), R.summaryObj = t, R.labelEl = E, d.appendChild(R), R;
|
|
2318
|
+
}, xo = function(e = {}) {
|
|
2461
2319
|
if (!this.currentNodes) return;
|
|
2462
|
-
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } =
|
|
2320
|
+
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } = yo(t), c = { id: z(), parent: s, start: i, end: l, label: "summary", style: e.style }, r = Me(this, c);
|
|
2463
2321
|
n.push(c), this.editSummary(r), o.fire("operation", {
|
|
2464
2322
|
name: "createSummary",
|
|
2465
2323
|
obj: c
|
|
2466
2324
|
});
|
|
2467
|
-
},
|
|
2468
|
-
const t =
|
|
2325
|
+
}, Eo = function(e) {
|
|
2326
|
+
const t = z(), n = { ...e, id: t };
|
|
2469
2327
|
Me(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
2470
2328
|
name: "createSummary",
|
|
2471
2329
|
obj: n
|
|
2472
2330
|
});
|
|
2473
|
-
},
|
|
2331
|
+
}, Co = function(e) {
|
|
2474
2332
|
const t = this.summaries.findIndex((n) => n.id === e);
|
|
2475
2333
|
t > -1 && (this.summaries.splice(t, 1), this.nodes.querySelector("#s-" + e)?.remove(), this.nodes.querySelector("#label-s-" + e)?.remove()), this.bus.fire("operation", {
|
|
2476
2334
|
name: "removeSummary",
|
|
2477
2335
|
obj: { id: e }
|
|
2478
2336
|
});
|
|
2479
|
-
},
|
|
2337
|
+
}, So = function(e) {
|
|
2480
2338
|
const t = e.labelEl;
|
|
2481
2339
|
t && t.classList.add("selected"), this.currentSummary = e;
|
|
2482
|
-
},
|
|
2340
|
+
}, No = function() {
|
|
2483
2341
|
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
|
|
2484
|
-
},
|
|
2342
|
+
}, To = function() {
|
|
2485
2343
|
this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
|
|
2486
2344
|
try {
|
|
2487
2345
|
Me(this, e);
|
|
2488
2346
|
} catch {
|
|
2489
2347
|
}
|
|
2490
2348
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
2491
|
-
},
|
|
2492
|
-
e && e.labelEl &&
|
|
2493
|
-
},
|
|
2349
|
+
}, _o = function(e) {
|
|
2350
|
+
e && e.labelEl && lt(this, e.labelEl, e.summaryObj);
|
|
2351
|
+
}, ko = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2494
2352
|
__proto__: null,
|
|
2495
|
-
createSummary:
|
|
2496
|
-
createSummaryFrom:
|
|
2497
|
-
editSummary:
|
|
2498
|
-
removeSummary:
|
|
2499
|
-
renderSummary:
|
|
2500
|
-
selectSummary:
|
|
2501
|
-
unselectSummary:
|
|
2353
|
+
createSummary: xo,
|
|
2354
|
+
createSummaryFrom: Eo,
|
|
2355
|
+
editSummary: _o,
|
|
2356
|
+
removeSummary: Co,
|
|
2357
|
+
renderSummary: To,
|
|
2358
|
+
selectSummary: So,
|
|
2359
|
+
unselectSummary: No
|
|
2502
2360
|
}, Symbol.toStringTag, { value: "Module" })), P = "http://www.w3.org/2000/svg";
|
|
2503
|
-
function
|
|
2361
|
+
function Lo(e, t) {
|
|
2504
2362
|
const n = document.createElementNS(P, "svg");
|
|
2505
|
-
return
|
|
2363
|
+
return D(n, {
|
|
2506
2364
|
version: "1.1",
|
|
2507
2365
|
xmlns: P,
|
|
2508
2366
|
height: e,
|
|
2509
2367
|
width: t
|
|
2510
2368
|
}), n;
|
|
2511
2369
|
}
|
|
2512
|
-
function
|
|
2370
|
+
function Do(e, t) {
|
|
2513
2371
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2514
2372
|
}
|
|
2515
|
-
function
|
|
2373
|
+
function Ao(e, t, n, o) {
|
|
2516
2374
|
const s = document.createElementNS(P, "g");
|
|
2517
2375
|
let i = "";
|
|
2518
2376
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
2519
2377
|
`).forEach((c, r) => {
|
|
2520
2378
|
const a = document.createElementNS(P, "text");
|
|
2521
|
-
|
|
2379
|
+
D(a, {
|
|
2522
2380
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2523
|
-
y: o + parseInt(t.paddingTop) +
|
|
2381
|
+
y: o + parseInt(t.paddingTop) + Do(t.lineHeight, t.fontSize) * (r + 1) + parseFloat(t.fontSize) * (r + 1) + "",
|
|
2524
2382
|
"text-anchor": "start",
|
|
2525
2383
|
"font-family": t.fontFamily,
|
|
2526
2384
|
"font-size": `${t.fontSize}`,
|
|
@@ -2529,25 +2387,25 @@ function Po(e, t, n, o) {
|
|
|
2529
2387
|
}), a.innerHTML = c, s.appendChild(a);
|
|
2530
2388
|
}), s;
|
|
2531
2389
|
}
|
|
2532
|
-
function
|
|
2390
|
+
function Mo(e, t, n, o) {
|
|
2533
2391
|
let s = "";
|
|
2534
2392
|
e.nodeObj?.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
2535
2393
|
const i = document.createElementNS(P, "foreignObject");
|
|
2536
|
-
|
|
2394
|
+
D(i, {
|
|
2537
2395
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2538
2396
|
y: o + parseInt(t.paddingTop) + "",
|
|
2539
2397
|
width: t.width,
|
|
2540
2398
|
height: t.height
|
|
2541
2399
|
});
|
|
2542
2400
|
const l = document.createElement("div");
|
|
2543
|
-
return
|
|
2401
|
+
return D(l, {
|
|
2544
2402
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
2545
2403
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
2546
2404
|
}), l.innerHTML = s, i.appendChild(l), i;
|
|
2547
2405
|
}
|
|
2548
|
-
function
|
|
2549
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2550
|
-
return
|
|
2406
|
+
function Po(e, t) {
|
|
2407
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = document.createElementNS(P, "rect");
|
|
2408
|
+
return D(i, {
|
|
2551
2409
|
x: o + "",
|
|
2552
2410
|
y: s + "",
|
|
2553
2411
|
rx: n.borderRadius,
|
|
@@ -2560,8 +2418,8 @@ function $o(e, t) {
|
|
|
2560
2418
|
}), i;
|
|
2561
2419
|
}
|
|
2562
2420
|
function se(e, t, n = !1) {
|
|
2563
|
-
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } =
|
|
2564
|
-
|
|
2421
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = H(e.nodes, t), l = document.createElementNS(P, "rect");
|
|
2422
|
+
D(l, {
|
|
2565
2423
|
x: s + "",
|
|
2566
2424
|
y: i + "",
|
|
2567
2425
|
rx: o.borderRadius,
|
|
@@ -2575,11 +2433,11 @@ function se(e, t, n = !1) {
|
|
|
2575
2433
|
const c = document.createElementNS(P, "g");
|
|
2576
2434
|
c.appendChild(l);
|
|
2577
2435
|
let r;
|
|
2578
|
-
return n ? r =
|
|
2436
|
+
return n ? r = Mo(t, o, s, i) : r = Ao(t, o, s, i), c.appendChild(r), c;
|
|
2579
2437
|
}
|
|
2580
|
-
function
|
|
2581
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2582
|
-
return
|
|
2438
|
+
function Oo(e, t) {
|
|
2439
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = document.createElementNS(P, "a"), l = document.createElementNS(P, "text");
|
|
2440
|
+
return D(l, {
|
|
2583
2441
|
x: o + "",
|
|
2584
2442
|
y: s + parseInt(n.fontSize) + "",
|
|
2585
2443
|
"text-anchor": "start",
|
|
@@ -2589,9 +2447,9 @@ function jo(e, t) {
|
|
|
2589
2447
|
fill: `${n.color}`
|
|
2590
2448
|
}), l.innerHTML = t.textContent, i.appendChild(l), i.setAttribute("href", t.href), i;
|
|
2591
2449
|
}
|
|
2592
|
-
function
|
|
2593
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2594
|
-
return
|
|
2450
|
+
function $o(e, t) {
|
|
2451
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = document.createElementNS(P, "image");
|
|
2452
|
+
return D(i, {
|
|
2595
2453
|
x: o + "",
|
|
2596
2454
|
y: s + "",
|
|
2597
2455
|
width: n.width + "",
|
|
@@ -2599,17 +2457,17 @@ function Ho(e, t) {
|
|
|
2599
2457
|
href: t.src
|
|
2600
2458
|
}), i;
|
|
2601
2459
|
}
|
|
2602
|
-
const ie = 100,
|
|
2603
|
-
const n = e.nodes, o = n.offsetHeight + ie * 2, s = n.offsetWidth + ie * 2, i =
|
|
2604
|
-
|
|
2460
|
+
const ie = 100, Ho = '<?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">', jo = (e, t = !1) => {
|
|
2461
|
+
const n = e.nodes, o = n.offsetHeight + ie * 2, s = n.offsetWidth + ie * 2, i = Lo(o + "px", s + "px"), l = document.createElementNS(P, "svg"), c = document.createElementNS(P, "rect");
|
|
2462
|
+
D(c, {
|
|
2605
2463
|
x: "0",
|
|
2606
2464
|
y: "0",
|
|
2607
2465
|
width: `${s}`,
|
|
2608
2466
|
height: `${o}`,
|
|
2609
2467
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2610
2468
|
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((h) => {
|
|
2611
|
-
const u = h.cloneNode(!0), { offsetLeft: y, offsetTop:
|
|
2612
|
-
u.setAttribute("x", `${y}`), u.setAttribute("y", `${
|
|
2469
|
+
const u = h.cloneNode(!0), { offsetLeft: y, offsetTop: b } = H(n, h.parentElement);
|
|
2470
|
+
u.setAttribute("x", `${y}`), u.setAttribute("y", `${b}`), l.appendChild(u);
|
|
2613
2471
|
});
|
|
2614
2472
|
const r = n.querySelector(".lines")?.cloneNode(!0);
|
|
2615
2473
|
r && l.appendChild(r);
|
|
@@ -2617,22 +2475,22 @@ const ie = 100, Io = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2617
2475
|
a && l.appendChild(a);
|
|
2618
2476
|
const d = n.querySelector(".summary")?.cloneNode(!0);
|
|
2619
2477
|
return d && l.appendChild(d), n.querySelectorAll("me-tpc").forEach((h) => {
|
|
2620
|
-
h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(se(e, h, !t)) : (l.appendChild(
|
|
2478
|
+
h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(se(e, h, !t)) : (l.appendChild(Po(e, h)), l.appendChild(se(e, h.text, !t)));
|
|
2621
2479
|
}), n.querySelectorAll(".tags > span").forEach((h) => {
|
|
2622
2480
|
l.appendChild(se(e, h));
|
|
2623
2481
|
}), n.querySelectorAll(".icons > span").forEach((h) => {
|
|
2624
2482
|
l.appendChild(se(e, h));
|
|
2625
2483
|
}), n.querySelectorAll(".hyper-link").forEach((h) => {
|
|
2626
|
-
l.appendChild(
|
|
2484
|
+
l.appendChild(Oo(e, h));
|
|
2627
2485
|
}), n.querySelectorAll("img").forEach((h) => {
|
|
2628
|
-
l.appendChild(
|
|
2629
|
-
}),
|
|
2486
|
+
l.appendChild($o(e, h));
|
|
2487
|
+
}), D(l, {
|
|
2630
2488
|
x: ie + "",
|
|
2631
2489
|
y: ie + "",
|
|
2632
2490
|
overflow: "visible"
|
|
2633
2491
|
}), i.appendChild(l), i;
|
|
2634
|
-
},
|
|
2635
|
-
function
|
|
2492
|
+
}, Io = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Ho + e.outerHTML);
|
|
2493
|
+
function Ro(e) {
|
|
2636
2494
|
return new Promise((t, n) => {
|
|
2637
2495
|
const o = new FileReader();
|
|
2638
2496
|
o.onload = (s) => {
|
|
@@ -2642,11 +2500,11 @@ function Fo(e) {
|
|
|
2642
2500
|
}, o.readAsDataURL(e);
|
|
2643
2501
|
});
|
|
2644
2502
|
}
|
|
2645
|
-
const
|
|
2646
|
-
const n =
|
|
2503
|
+
const Bo = function(e = !1, t) {
|
|
2504
|
+
const n = jo(this, e), o = Io(n, t);
|
|
2647
2505
|
return new Blob([o], { type: "image/svg+xml" });
|
|
2648
|
-
},
|
|
2649
|
-
const n = this.exportSvg(e, t), o = await
|
|
2506
|
+
}, Yo = async function(e = !1, t) {
|
|
2507
|
+
const n = this.exportSvg(e, t), o = await Ro(n);
|
|
2650
2508
|
return new Promise((s, i) => {
|
|
2651
2509
|
const l = new Image();
|
|
2652
2510
|
l.setAttribute("crossOrigin", "anonymous"), l.onload = () => {
|
|
@@ -2654,48 +2512,48 @@ const Yo = function(e = !1, t) {
|
|
|
2654
2512
|
c.width = l.width, c.height = l.height, c.getContext("2d").drawImage(l, 0, 0), c.toBlob(s, "image/png", 1);
|
|
2655
2513
|
}, l.src = o, l.onerror = i;
|
|
2656
2514
|
});
|
|
2657
|
-
},
|
|
2515
|
+
}, Wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2658
2516
|
__proto__: null,
|
|
2659
|
-
exportPng:
|
|
2660
|
-
exportSvg:
|
|
2517
|
+
exportPng: Yo,
|
|
2518
|
+
exportSvg: Bo
|
|
2661
2519
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2662
|
-
function
|
|
2520
|
+
function Xo(e, t) {
|
|
2663
2521
|
return async function(...n) {
|
|
2664
2522
|
const o = this.before[t];
|
|
2665
2523
|
o && !await o.apply(this, n) || e.apply(this, n);
|
|
2666
2524
|
};
|
|
2667
2525
|
}
|
|
2668
|
-
const
|
|
2669
|
-
for (let e = 0; e <
|
|
2670
|
-
const t =
|
|
2671
|
-
|
|
2526
|
+
const Ue = Object.keys(ot), ft = {};
|
|
2527
|
+
for (let e = 0; e < Ue.length; e++) {
|
|
2528
|
+
const t = Ue[e];
|
|
2529
|
+
ft[t] = Xo(ot[t], t);
|
|
2672
2530
|
}
|
|
2673
|
-
const
|
|
2531
|
+
const Fo = {
|
|
2674
2532
|
getObjById: le,
|
|
2675
|
-
generateNewObj:
|
|
2676
|
-
layout:
|
|
2677
|
-
linkDiv:
|
|
2678
|
-
editTopic:
|
|
2679
|
-
createWrapper:
|
|
2680
|
-
createParent:
|
|
2681
|
-
createChildren:
|
|
2682
|
-
createTopic:
|
|
2683
|
-
findEle:
|
|
2684
|
-
changeTheme:
|
|
2685
|
-
...
|
|
2686
|
-
...
|
|
2687
|
-
...
|
|
2688
|
-
...
|
|
2689
|
-
...
|
|
2533
|
+
generateNewObj: ut,
|
|
2534
|
+
layout: pt,
|
|
2535
|
+
linkDiv: Dn,
|
|
2536
|
+
editTopic: xt,
|
|
2537
|
+
createWrapper: yt,
|
|
2538
|
+
createParent: bt,
|
|
2539
|
+
createChildren: vt,
|
|
2540
|
+
createTopic: wt,
|
|
2541
|
+
findEle: Ze,
|
|
2542
|
+
changeTheme: Qn,
|
|
2543
|
+
...un,
|
|
2544
|
+
...ft,
|
|
2545
|
+
...mo,
|
|
2546
|
+
...ko,
|
|
2547
|
+
...Wo,
|
|
2690
2548
|
init(e) {
|
|
2691
2549
|
if (e = JSON.parse(JSON.stringify(e)), !e || !e.nodeData) return new Error("MindElixir: `data` is required");
|
|
2692
|
-
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData,
|
|
2550
|
+
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, V(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && Gn(this), this.keypress && bn(this, this.keypress), Zn(this), this.disposable.push(Tn()), this.contextMenu && this.disposable.push(Mn(this, this.contextMenu)), this.allowUndo && this.disposable.push(On(this)), this.layout(), this.linkDiv(), this.toCenter();
|
|
2693
2551
|
},
|
|
2694
2552
|
destroy() {
|
|
2695
2553
|
this.disposable.forEach((e) => e()), this.el && (this.el.innerHTML = ""), this.el = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, this.selection?.destroy(), this.selection = void 0;
|
|
2696
2554
|
}
|
|
2697
2555
|
};
|
|
2698
|
-
function
|
|
2556
|
+
function Go({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction: r, containerHeight: a }) {
|
|
2699
2557
|
let d = t + n / 2;
|
|
2700
2558
|
const h = e + o / 2;
|
|
2701
2559
|
let u;
|
|
@@ -2703,17 +2561,17 @@ function Vo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction:
|
|
|
2703
2561
|
const y = s + c / 2, p = (1 - Math.abs(y - h) / a) * 0.25 * (n / 2);
|
|
2704
2562
|
return r === B.LHS ? d = d - n / 10 - p : d = d + n / 10 + p, `M ${d} ${h} Q ${d} ${y} ${u} ${y}`;
|
|
2705
2563
|
}
|
|
2706
|
-
function
|
|
2564
|
+
function Vo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction: r, isFirst: a }) {
|
|
2707
2565
|
const d = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
2708
2566
|
let h = 0, u = 0;
|
|
2709
2567
|
a ? h = e + o / 2 : h = e + o;
|
|
2710
2568
|
const y = s + c;
|
|
2711
|
-
let
|
|
2569
|
+
let b = 0, p = 0, g = 0;
|
|
2712
2570
|
const m = Math.abs(h - y) / 300 * d;
|
|
2713
|
-
return r === B.LHS ? (g = t,
|
|
2571
|
+
return r === B.LHS ? (g = t, b = g + d, p = g - d, u = i + d, `M ${b} ${h} C ${g} ${h} ${g + m} ${y} ${p} ${y} H ${u}`) : (g = t + n, b = g - d, p = g + d, u = i + l - d, `M ${b} ${h} C ${g} ${h} ${g - m} ${y} ${p} ${y} H ${u}`);
|
|
2714
2572
|
}
|
|
2715
|
-
const
|
|
2716
|
-
function
|
|
2573
|
+
const zo = "5.10.0";
|
|
2574
|
+
function Ko(e) {
|
|
2717
2575
|
return {
|
|
2718
2576
|
x: 0,
|
|
2719
2577
|
y: 0,
|
|
@@ -2731,39 +2589,38 @@ function Uo(e) {
|
|
|
2731
2589
|
function I({
|
|
2732
2590
|
el: e,
|
|
2733
2591
|
direction: t,
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
imageProxy: E,
|
|
2592
|
+
editable: n,
|
|
2593
|
+
contextMenu: o,
|
|
2594
|
+
toolBar: s,
|
|
2595
|
+
keypress: i,
|
|
2596
|
+
mouseSelectionButton: l,
|
|
2597
|
+
selectionContainer: c,
|
|
2598
|
+
before: r,
|
|
2599
|
+
newTopicName: a,
|
|
2600
|
+
allowUndo: d,
|
|
2601
|
+
generateMainBranch: h,
|
|
2602
|
+
generateSubBranch: u,
|
|
2603
|
+
overflowHidden: y,
|
|
2604
|
+
theme: b,
|
|
2605
|
+
alignment: p,
|
|
2606
|
+
scaleSensitivity: g,
|
|
2607
|
+
scaleMax: m,
|
|
2608
|
+
scaleMin: v,
|
|
2609
|
+
handleWheel: E,
|
|
2610
|
+
markdown: k,
|
|
2611
|
+
imageProxy: _,
|
|
2755
2612
|
pasteHandler: C
|
|
2756
2613
|
}) {
|
|
2757
|
-
let
|
|
2614
|
+
let x = null;
|
|
2758
2615
|
const N = Object.prototype.toString.call(e);
|
|
2759
|
-
if (N === "[object HTMLDivElement]" ?
|
|
2760
|
-
|
|
2761
|
-
const
|
|
2762
|
-
this.theme =
|
|
2763
|
-
const
|
|
2764
|
-
|
|
2616
|
+
if (N === "[object HTMLDivElement]" ? x = e : N === "[object String]" && (x = document.querySelector(e)), !x) throw new Error("MindElixir: el is not a valid element");
|
|
2617
|
+
x.style.position = "relative", x.innerHTML = "", this.el = x, this.disposable = [], this.before = r || {}, this.newTopicName = a || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = l ?? 0, this.direction = t ?? 1, this.editable = n ?? !0, this.allowUndo = d ?? !0, this.scaleSensitivity = g ?? 0.1, this.scaleMax = m ?? 1.4, this.scaleMin = v ?? 0.2, this.generateMainBranch = h || Go, this.generateSubBranch = u || Vo, this.overflowHidden = y ?? !1, this.alignment = p ?? "root", this.handleWheel = E ?? !0, this.markdown = k || void 0, this.imageProxy = _ || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = Ko(this), this.bus = kn(), this.container = document.createElement("div"), this.selectionContainer = c || this.container, this.container.className = "map-container";
|
|
2618
|
+
const S = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2619
|
+
this.theme = b || (S.matches ? we : ve);
|
|
2620
|
+
const A = document.createElement("div");
|
|
2621
|
+
A.className = "map-canvas", this.map = A, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines = Q("lines"), this.summarySvg = Q("summary"), this.linkController = Q("linkcontroller"), this.P2 = document.createElement("div"), this.P3 = document.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = Re(), this.line2 = Re(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = Q("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(_n(this)), C && (this.pasteHandler = C);
|
|
2765
2622
|
}
|
|
2766
|
-
I.prototype =
|
|
2623
|
+
I.prototype = Fo;
|
|
2767
2624
|
Object.defineProperty(I.prototype, "currentNode", {
|
|
2768
2625
|
get() {
|
|
2769
2626
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
@@ -2773,22 +2630,22 @@ Object.defineProperty(I.prototype, "currentNode", {
|
|
|
2773
2630
|
I.LEFT = 0;
|
|
2774
2631
|
I.RIGHT = 1;
|
|
2775
2632
|
I.SIDE = 2;
|
|
2776
|
-
I.THEME =
|
|
2633
|
+
I.THEME = ve;
|
|
2777
2634
|
I.DARK_THEME = we;
|
|
2778
|
-
I.version =
|
|
2779
|
-
I.E =
|
|
2635
|
+
I.version = zo;
|
|
2636
|
+
I.E = Ze;
|
|
2780
2637
|
I.new = (e) => ({
|
|
2781
2638
|
nodeData: {
|
|
2782
|
-
id:
|
|
2639
|
+
id: z(),
|
|
2783
2640
|
topic: e || "new topic",
|
|
2784
2641
|
children: []
|
|
2785
2642
|
}
|
|
2786
2643
|
});
|
|
2787
2644
|
export {
|
|
2788
2645
|
we as DARK_THEME,
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2646
|
+
qo as LEFT,
|
|
2647
|
+
Uo as RIGHT,
|
|
2648
|
+
Jo as SIDE,
|
|
2649
|
+
ve as THEME,
|
|
2793
2650
|
I as default
|
|
2794
2651
|
};
|