mind-elixir 5.12.2-beta.1 → 5.12.2-beta.3
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 +340 -346
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +252 -258
- package/package.json +1 -1
package/dist/MindElixirLite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const Wn = 0, Yn = 1, Rn = 2,
|
|
1
|
+
const Wn = 0, Yn = 1, Rn = 2, G = {
|
|
2
2
|
name: "Latte",
|
|
3
3
|
type: "light",
|
|
4
4
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -53,7 +53,7 @@ const Wn = 0, Yn = 1, Rn = 2, Y = {
|
|
|
53
53
|
"--map-padding": "50px 80px"
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
function
|
|
56
|
+
function It(t) {
|
|
57
57
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
58
58
|
}
|
|
59
59
|
const _ = function(t, e) {
|
|
@@ -85,11 +85,11 @@ function q(t, e, n, o) {
|
|
|
85
85
|
y2: o + Math.sin(d) * l
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function Y() {
|
|
89
89
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substring(2)).substring(2, 18);
|
|
90
90
|
}
|
|
91
|
-
const
|
|
92
|
-
const t =
|
|
91
|
+
const Ot = function() {
|
|
92
|
+
const t = Y();
|
|
93
93
|
return {
|
|
94
94
|
topic: this.newTopicName,
|
|
95
95
|
id: t
|
|
@@ -119,7 +119,7 @@ const Ht = function() {
|
|
|
119
119
|
}, ht = (t, e) => {
|
|
120
120
|
const n = t.x - e.x, o = t.y - e.y;
|
|
121
121
|
return Math.sqrt(n * n + o * o);
|
|
122
|
-
},
|
|
122
|
+
}, Bt = function(t, e) {
|
|
123
123
|
if (!e)
|
|
124
124
|
return U(t), t;
|
|
125
125
|
let n = t.querySelector(".insert-preview");
|
|
@@ -136,11 +136,11 @@ const Ht = function() {
|
|
|
136
136
|
if (!(t && t.tagName === "ME-TPC" && t !== n && !o && t.nodeObj.parent)) return !1;
|
|
137
137
|
}
|
|
138
138
|
return !0;
|
|
139
|
-
},
|
|
139
|
+
}, Wt = function(t) {
|
|
140
140
|
const e = document.createElement("div");
|
|
141
141
|
return e.className = "mind-elixir-ghost", t.container.appendChild(e), e;
|
|
142
142
|
};
|
|
143
|
-
class
|
|
143
|
+
class Yt {
|
|
144
144
|
mind;
|
|
145
145
|
isMoving = !1;
|
|
146
146
|
interval = null;
|
|
@@ -157,19 +157,19 @@ class Bt {
|
|
|
157
157
|
this.isMoving = !1, this.interval && (clearInterval(this.interval), this.interval = null);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function Rt(t) {
|
|
161
161
|
return {
|
|
162
162
|
isDragging: !1,
|
|
163
163
|
insertType: null,
|
|
164
164
|
meet: null,
|
|
165
|
-
ghost:
|
|
166
|
-
edgeMoveController: new
|
|
165
|
+
ghost: Wt(t),
|
|
166
|
+
edgeMoveController: new Yt(t),
|
|
167
167
|
startX: 0,
|
|
168
168
|
startY: 0,
|
|
169
169
|
pointerId: null
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
|
-
const
|
|
172
|
+
const Xt = 5;
|
|
173
173
|
function ft(t, e, n, o = !1) {
|
|
174
174
|
if (t.spacePressed) return !1;
|
|
175
175
|
const s = n.target;
|
|
@@ -193,11 +193,11 @@ function xt(t, e) {
|
|
|
193
193
|
s.parentElement.parentElement.style.opacity = "0.5";
|
|
194
194
|
t.panHelper.clear();
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function Vt(t, e, n) {
|
|
197
197
|
const { dragged: o } = t;
|
|
198
198
|
if (!o || e.pointerId !== n.pointerId) return;
|
|
199
199
|
const s = n.clientX - e.startX, i = n.clientY - e.startY, r = Math.sqrt(s * s + i * i);
|
|
200
|
-
if (!e.isDragging && r >
|
|
200
|
+
if (!e.isDragging && r > Xt && xt(t, e), !e.isDragging) return;
|
|
201
201
|
const c = t.container.getBoundingClientRect();
|
|
202
202
|
bt(e.ghost, n.clientX - c.x, n.clientY - c.y), n.clientX < c.x + 50 ? e.edgeMoveController.move(1, 0) : n.clientX > c.x + c.width - 50 ? e.edgeMoveController.move(-1, 0) : n.clientY < c.y + 50 ? e.edgeMoveController.move(0, 1) : n.clientY > c.y + c.height - 50 ? e.edgeMoveController.move(0, -1) : e.edgeMoveController.stop(), U(e.meet);
|
|
203
203
|
const l = 12 * t.scaleVal, a = document.elementFromPoint(n.clientX, n.clientY - l);
|
|
@@ -214,9 +214,9 @@ function Rt(t, e, n) {
|
|
|
214
214
|
} else
|
|
215
215
|
e.insertType = null, e.meet = null;
|
|
216
216
|
}
|
|
217
|
-
e.meet &&
|
|
217
|
+
e.meet && Bt(e.meet, e.insertType);
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function zt(t, e, n) {
|
|
220
220
|
const { dragged: o } = t;
|
|
221
221
|
if (!(!o || e.pointerId !== n.pointerId)) {
|
|
222
222
|
e.edgeMoveController.stop();
|
|
@@ -237,7 +237,7 @@ function ut(t, e) {
|
|
|
237
237
|
const O = {
|
|
238
238
|
LHS: "lhs",
|
|
239
239
|
RHS: "rhs"
|
|
240
|
-
},
|
|
240
|
+
}, Ft = function() {
|
|
241
241
|
this.nodes.innerHTML = "";
|
|
242
242
|
const t = this.createTopic(this.nodeData);
|
|
243
243
|
St.call(this, t, this.nodeData), t.draggable = !1;
|
|
@@ -250,8 +250,8 @@ const O = {
|
|
|
250
250
|
i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
|
|
251
251
|
});
|
|
252
252
|
}
|
|
253
|
-
|
|
254
|
-
},
|
|
253
|
+
Gt(this, n, e);
|
|
254
|
+
}, Gt = function(t, e, n) {
|
|
255
255
|
const o = document.createElement("me-main");
|
|
256
256
|
o.className = O.LHS;
|
|
257
257
|
const s = document.createElement("me-main");
|
|
@@ -261,7 +261,7 @@ const O = {
|
|
|
261
261
|
t.direction === 2 ? r.direction === 0 ? o.appendChild(c) : s.appendChild(c) : t.direction === 0 ? o.appendChild(c) : s.appendChild(c);
|
|
262
262
|
}
|
|
263
263
|
t.nodes.appendChild(o), t.nodes.appendChild(n), t.nodes.appendChild(s), t.nodes.appendChild(t.lines), t.nodes.appendChild(t.labelContainer);
|
|
264
|
-
},
|
|
264
|
+
}, _t = function(t, e) {
|
|
265
265
|
const n = document.createElement("me-children");
|
|
266
266
|
for (let o = 0; o < e.length; o++) {
|
|
267
267
|
const s = e[o], { grp: i } = t.createWrapper(s);
|
|
@@ -299,7 +299,7 @@ const O = {
|
|
|
299
299
|
} else t.link && (t.link = void 0);
|
|
300
300
|
if (e.icons && e.icons.length) {
|
|
301
301
|
const n = document.createElement("span");
|
|
302
|
-
n.className = "icons", n.innerHTML = e.icons.map((o) => `<span>${
|
|
302
|
+
n.className = "icons", n.innerHTML = e.icons.map((o) => `<span>${It(o)}</span>`).join(""), t.appendChild(n), t.icons = n;
|
|
303
303
|
} else t.icons && (t.icons = void 0);
|
|
304
304
|
if (e.tags && e.tags.length) {
|
|
305
305
|
const n = document.createElement("div");
|
|
@@ -308,23 +308,23 @@ const O = {
|
|
|
308
308
|
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);
|
|
309
309
|
}), t.appendChild(n), t.tags = n;
|
|
310
310
|
} else t.tags && (t.tags = void 0);
|
|
311
|
-
},
|
|
311
|
+
}, qt = function(t, e) {
|
|
312
312
|
const n = document.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(t);
|
|
313
313
|
if (n.appendChild(o), !e && t.children && t.children.length > 0) {
|
|
314
|
-
const i =
|
|
314
|
+
const i = Zt(t.expanded);
|
|
315
315
|
if (o.appendChild(i), t.expanded !== !1) {
|
|
316
|
-
const r =
|
|
316
|
+
const r = _t(this, t.children);
|
|
317
317
|
n.appendChild(r);
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
return { grp: n, top: o, tpc: s };
|
|
321
|
-
},
|
|
321
|
+
}, jt = function(t) {
|
|
322
322
|
const e = document.createElement("me-parent"), n = this.createTopic(t);
|
|
323
323
|
return St.call(this, n, t), e.appendChild(n), { p: e, tpc: n };
|
|
324
|
-
},
|
|
324
|
+
}, Ut = function(t) {
|
|
325
325
|
const e = document.createElement("me-children");
|
|
326
326
|
return e.append(...t), e;
|
|
327
|
-
},
|
|
327
|
+
}, Kt = function(t) {
|
|
328
328
|
const e = document.createElement("me-tpc");
|
|
329
329
|
return e.nodeObj = t, e.dataset.nodeid = "me" + t.id, e;
|
|
330
330
|
};
|
|
@@ -334,7 +334,7 @@ function Et(t) {
|
|
|
334
334
|
const n = window.getSelection();
|
|
335
335
|
n && (n.removeAllRanges(), n.addRange(e));
|
|
336
336
|
}
|
|
337
|
-
const
|
|
337
|
+
const Jt = function(t) {
|
|
338
338
|
if (!t) return;
|
|
339
339
|
const e = document.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = P(this.nodes, t);
|
|
340
340
|
this.nodes.appendChild(e), e.id = "input-box", e.textContent = o, e.contentEditable = "plaintext-only", e.spellcheck = !1;
|
|
@@ -369,14 +369,14 @@ const Ut = function(t) {
|
|
|
369
369
|
origin: o
|
|
370
370
|
}));
|
|
371
371
|
});
|
|
372
|
-
},
|
|
372
|
+
}, Zt = function(t) {
|
|
373
373
|
const e = document.createElement("me-epd");
|
|
374
374
|
return e.expanded = t !== !1, e.className = t !== !1 ? "minus" : "", e;
|
|
375
|
-
},
|
|
375
|
+
}, Qt = function(t) {
|
|
376
376
|
const n = t.parentElement.parentElement.lastElementChild;
|
|
377
377
|
n?.tagName === "svg" && n?.remove();
|
|
378
378
|
};
|
|
379
|
-
function
|
|
379
|
+
function te(t) {
|
|
380
380
|
return {
|
|
381
381
|
nodeData: t.isFocusMode ? t.nodeDataBackup : t.nodeData,
|
|
382
382
|
arrows: t.arrows,
|
|
@@ -387,44 +387,44 @@ function Zt(t) {
|
|
|
387
387
|
meta: t.meta
|
|
388
388
|
};
|
|
389
389
|
}
|
|
390
|
-
const
|
|
390
|
+
const ee = function(t, e = !1) {
|
|
391
391
|
const n = this.container, o = t.getBoundingClientRect(), s = n.getBoundingClientRect();
|
|
392
392
|
if (e || o.top > s.bottom - 50 || o.bottom < s.top + 50 || o.left > s.right - 50 || o.right < s.left + 50) {
|
|
393
393
|
const r = o.left + o.width / 2, c = o.top + o.height / 2, l = s.left + s.width / 2, a = s.top + s.height / 2, f = r - l, d = c - a;
|
|
394
394
|
this.move(-f, -d, !0);
|
|
395
395
|
}
|
|
396
|
-
},
|
|
396
|
+
}, ne = function(t, e, n) {
|
|
397
397
|
this.clearSelection(), this.scrollIntoView(t), this.selection?.select(t), e && this.bus.fire("selectNewNode", t.nodeObj);
|
|
398
|
-
},
|
|
398
|
+
}, oe = function(t) {
|
|
399
399
|
this.selection?.select(t);
|
|
400
|
-
},
|
|
400
|
+
}, se = function(t) {
|
|
401
401
|
this.selection?.deselect(t);
|
|
402
|
-
},
|
|
402
|
+
}, ie = function() {
|
|
403
403
|
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
404
404
|
}, Tt = function(t) {
|
|
405
405
|
return JSON.stringify(t, (e, n) => {
|
|
406
406
|
if (!(e === "parent" && typeof n != "string"))
|
|
407
407
|
return n;
|
|
408
408
|
});
|
|
409
|
-
},
|
|
410
|
-
const t =
|
|
409
|
+
}, re = function() {
|
|
410
|
+
const t = te(this);
|
|
411
411
|
return Tt(t);
|
|
412
|
-
},
|
|
412
|
+
}, ce = function() {
|
|
413
413
|
return JSON.parse(this.getDataString());
|
|
414
|
-
},
|
|
414
|
+
}, le = function() {
|
|
415
415
|
this.editable = !0;
|
|
416
|
-
},
|
|
416
|
+
}, ae = function() {
|
|
417
417
|
this.editable = !1;
|
|
418
|
-
},
|
|
418
|
+
}, he = function(t, e = { x: 0, y: 0 }) {
|
|
419
419
|
if (t < this.scaleMin && t < this.scaleVal || t > this.scaleMax && t > this.scaleVal) return;
|
|
420
420
|
const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0, s = e.y ? e.y - n.top - n.height / 2 : 0, { dx: i, dy: r } = st(this), c = this.map.style.transform, { x: l, y: a } = ot(c), f = l - i, d = a - r, p = this.scaleVal, w = (-o + f) * (1 - t / p), y = (-s + d) * (1 - t / p);
|
|
421
421
|
this.map.style.transform = `translate3d(${l - w}px, ${a - y}px, 0) scale(${t})`, this.scaleVal = t, this.bus.fire("scale", t);
|
|
422
|
-
},
|
|
422
|
+
}, de = function() {
|
|
423
423
|
const t = this.nodes.offsetHeight / this.container.offsetHeight, e = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(t, e));
|
|
424
424
|
this.scaleVal = n;
|
|
425
425
|
const { dx: o, dy: s } = st(this, !0);
|
|
426
426
|
this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n);
|
|
427
|
-
},
|
|
427
|
+
}, fe = function(t, e, n = !1) {
|
|
428
428
|
const { map: o, scaleVal: s, bus: i, container: r, nodes: c } = this;
|
|
429
429
|
if (n && o.style.transition === "transform 0.3s")
|
|
430
430
|
return;
|
|
@@ -452,29 +452,29 @@ const Qt = function(t, e = !1) {
|
|
|
452
452
|
i = n.offsetWidth / 2 - a - f / 2, r = n.offsetHeight / 2 - l - d / 2, o.style.transformOrigin = `${a + f / 2}px 50%`;
|
|
453
453
|
}
|
|
454
454
|
return { dx: i, dy: r };
|
|
455
|
-
},
|
|
455
|
+
}, ue = function() {
|
|
456
456
|
const { map: t, container: e } = this, { dx: n, dy: o } = st(this);
|
|
457
457
|
e.scrollTop = 0, e.scrollLeft = 0, t.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
|
|
458
|
-
},
|
|
458
|
+
}, pe = function(t) {
|
|
459
459
|
t(this);
|
|
460
|
-
},
|
|
460
|
+
}, ge = function(t) {
|
|
461
461
|
t.nodeObj.parent && (this.clearSelection(), this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = t.nodeObj, this.initRight(), this.toCenter());
|
|
462
|
-
},
|
|
462
|
+
}, me = function() {
|
|
463
463
|
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
464
|
-
},
|
|
464
|
+
}, ye = function() {
|
|
465
465
|
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
466
|
-
},
|
|
466
|
+
}, we = function() {
|
|
467
467
|
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
468
|
-
},
|
|
468
|
+
}, ve = function() {
|
|
469
469
|
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
470
|
-
},
|
|
470
|
+
}, be = function(t, e) {
|
|
471
471
|
const n = t.nodeObj;
|
|
472
472
|
typeof e == "boolean" ? n.expanded = e : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
473
473
|
const o = t.getBoundingClientRect(), s = {
|
|
474
474
|
x: o.left,
|
|
475
475
|
y: o.top
|
|
476
476
|
}, i = t.parentNode, r = i.children[1];
|
|
477
|
-
if (r.expanded = n.expanded, r.className = n.expanded ? "minus" : "",
|
|
477
|
+
if (r.expanded = n.expanded, r.className = n.expanded ? "minus" : "", Qt(t), n.expanded) {
|
|
478
478
|
const d = this.createChildren(
|
|
479
479
|
n.children.map((p) => this.createWrapper(p).grp)
|
|
480
480
|
);
|
|
@@ -487,7 +487,7 @@ const Qt = function(t, e = !1) {
|
|
|
487
487
|
y: c.top
|
|
488
488
|
}, a = s.x - l.x, f = s.y - l.y;
|
|
489
489
|
this.move(a, f), this.bus.fire("expandNode", n);
|
|
490
|
-
},
|
|
490
|
+
}, xe = function(t, e) {
|
|
491
491
|
const n = t.nodeObj, o = t.getBoundingClientRect(), s = {
|
|
492
492
|
x: o.left,
|
|
493
493
|
y: o.top
|
|
@@ -498,48 +498,48 @@ const Qt = function(t, e = !1) {
|
|
|
498
498
|
y: i.top
|
|
499
499
|
}, c = s.x - r.x, l = s.y - r.y;
|
|
500
500
|
this.move(c, l);
|
|
501
|
-
},
|
|
501
|
+
}, Ce = function(t) {
|
|
502
502
|
this.clearSelection(), t && (t = JSON.parse(JSON.stringify(t)), this.nodeData = t.nodeData, this.arrows = t.arrows || [], this.summaries = t.summaries || [], t.meta && (this.meta = t.meta), t.theme && this.changeTheme(t.theme)), nt(this.nodeData), this.layout(), this.linkDiv();
|
|
503
|
-
},
|
|
503
|
+
}, Se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
504
504
|
__proto__: null,
|
|
505
|
-
cancelFocus:
|
|
506
|
-
clearSelection:
|
|
507
|
-
disableEdit:
|
|
508
|
-
enableEdit:
|
|
509
|
-
expandNode:
|
|
510
|
-
expandNodeAll:
|
|
511
|
-
focusNode:
|
|
512
|
-
getData:
|
|
513
|
-
getDataString:
|
|
514
|
-
initLeft:
|
|
515
|
-
initRight:
|
|
516
|
-
initSide:
|
|
517
|
-
install:
|
|
518
|
-
move:
|
|
519
|
-
refresh:
|
|
520
|
-
scale:
|
|
521
|
-
scaleFit:
|
|
522
|
-
scrollIntoView:
|
|
523
|
-
selectNode:
|
|
524
|
-
selectNodes:
|
|
505
|
+
cancelFocus: me,
|
|
506
|
+
clearSelection: ie,
|
|
507
|
+
disableEdit: ae,
|
|
508
|
+
enableEdit: le,
|
|
509
|
+
expandNode: be,
|
|
510
|
+
expandNodeAll: xe,
|
|
511
|
+
focusNode: ge,
|
|
512
|
+
getData: ce,
|
|
513
|
+
getDataString: re,
|
|
514
|
+
initLeft: ye,
|
|
515
|
+
initRight: we,
|
|
516
|
+
initSide: ve,
|
|
517
|
+
install: pe,
|
|
518
|
+
move: fe,
|
|
519
|
+
refresh: Ce,
|
|
520
|
+
scale: he,
|
|
521
|
+
scaleFit: de,
|
|
522
|
+
scrollIntoView: ee,
|
|
523
|
+
selectNode: ne,
|
|
524
|
+
selectNodes: oe,
|
|
525
525
|
stringifyData: Tt,
|
|
526
|
-
toCenter:
|
|
527
|
-
unselectNodes:
|
|
528
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
529
|
-
const i = -
|
|
526
|
+
toCenter: ue,
|
|
527
|
+
unselectNodes: se
|
|
528
|
+
}, Symbol.toStringTag, { value: "Module" })), Ee = 40, Te = 10, De = ({ deltaMode: t, deltaY: e, viewportHeight: n }) => t === WheelEvent.DOM_DELTA_LINE ? e * Ee : t === WheelEvent.DOM_DELTA_PAGE ? e * n : e, Le = ({ deltaMode: t, deltaY: e, scaleSensitivity: n, viewportHeight: o }) => {
|
|
529
|
+
const i = -De({ deltaMode: t, deltaY: e, viewportHeight: o }) / Te * n;
|
|
530
530
|
return Math.max(-n, Math.min(n, i));
|
|
531
|
-
},
|
|
531
|
+
}, Me = (t, e, n) => {
|
|
532
532
|
e !== 0 && t.scale(t.scaleVal + e, n);
|
|
533
|
-
},
|
|
534
|
-
const n =
|
|
533
|
+
}, Pe = (t, e) => {
|
|
534
|
+
const n = Le({
|
|
535
535
|
deltaMode: e.deltaMode,
|
|
536
536
|
deltaY: e.deltaY,
|
|
537
537
|
scaleSensitivity: t.scaleSensitivity,
|
|
538
538
|
viewportHeight: t.container.clientHeight || window.innerHeight
|
|
539
539
|
});
|
|
540
|
-
|
|
540
|
+
Me(t, n, { x: e.clientX, y: e.clientY });
|
|
541
541
|
};
|
|
542
|
-
function
|
|
542
|
+
function ke(t) {
|
|
543
543
|
const { panHelper: e, container: n } = t;
|
|
544
544
|
let o = null;
|
|
545
545
|
t.spacePressed = !1;
|
|
@@ -599,7 +599,7 @@ function Me(t) {
|
|
|
599
599
|
clear() {
|
|
600
600
|
this.activePointers.clear(), this.lastDistance = null;
|
|
601
601
|
}
|
|
602
|
-
}, c =
|
|
602
|
+
}, c = Rt(t), l = {
|
|
603
603
|
timer: null,
|
|
604
604
|
startPos: null,
|
|
605
605
|
pointerId: null,
|
|
@@ -681,7 +681,7 @@ function Me(t) {
|
|
|
681
681
|
l.handleMove(h), l.timer === null && (t.ptState = i.Idle);
|
|
682
682
|
break;
|
|
683
683
|
case i.Drag:
|
|
684
|
-
|
|
684
|
+
Vt(t, c, h);
|
|
685
685
|
break;
|
|
686
686
|
case i.Pan:
|
|
687
687
|
e.handlePointerMove(h);
|
|
@@ -695,7 +695,7 @@ function Me(t) {
|
|
|
695
695
|
l.clear();
|
|
696
696
|
break;
|
|
697
697
|
case i.Drag:
|
|
698
|
-
|
|
698
|
+
zt(t, c, h);
|
|
699
699
|
break;
|
|
700
700
|
case i.Pan:
|
|
701
701
|
e.handlePointerUp(h);
|
|
@@ -711,7 +711,7 @@ function Me(t) {
|
|
|
711
711
|
Z(m) && !m.classList.contains("selected") && t.selectNode(m), t.bus.fire("showContextMenu", h);
|
|
712
712
|
}, 200);
|
|
713
713
|
}, b = (h) => {
|
|
714
|
-
if (h.stopPropagation(), h.preventDefault(), h.ctrlKey || h.metaKey) return
|
|
714
|
+
if (h.stopPropagation(), h.preventDefault(), h.ctrlKey || h.metaKey) return Pe(t, h);
|
|
715
715
|
if (h.shiftKey) return t.move(-h.deltaY, 0);
|
|
716
716
|
t.move(-h.deltaX, -h.deltaY);
|
|
717
717
|
}, v = (h) => {
|
|
@@ -732,7 +732,7 @@ function Me(t) {
|
|
|
732
732
|
{ dom: n, evt: "keyup", func: C }
|
|
733
733
|
]);
|
|
734
734
|
}
|
|
735
|
-
function
|
|
735
|
+
function Ne() {
|
|
736
736
|
return {
|
|
737
737
|
handlers: {},
|
|
738
738
|
addListener: function(t, e) {
|
|
@@ -779,7 +779,7 @@ const k = "http://www.w3.org/2000/svg", K = function(t) {
|
|
|
779
779
|
}, pt = function() {
|
|
780
780
|
const t = document.createElementNS(k, "line");
|
|
781
781
|
return t.setAttribute("stroke", "#4dc4ff"), t.setAttribute("fill", "none"), t.setAttribute("stroke-width", "2"), t.setAttribute("opacity", "0.45"), t;
|
|
782
|
-
},
|
|
782
|
+
}, Ae = function(t, e, n, o) {
|
|
783
783
|
const s = document.createElementNS(k, "g");
|
|
784
784
|
return [
|
|
785
785
|
{
|
|
@@ -838,7 +838,7 @@ const k = "http://www.w3.org/2000/svg", K = function(t) {
|
|
|
838
838
|
obj: n
|
|
839
839
|
}));
|
|
840
840
|
});
|
|
841
|
-
},
|
|
841
|
+
}, $e = function(t) {
|
|
842
842
|
const e = this.map.querySelector("me-root"), n = e.offsetTop, o = e.offsetLeft, s = e.offsetWidth, i = e.offsetHeight, r = this.map.querySelectorAll("me-main > me-wrapper");
|
|
843
843
|
this.lines.innerHTML = "";
|
|
844
844
|
for (let c = 0; c < r.length; c++) {
|
|
@@ -863,19 +863,19 @@ const k = "http://www.w3.org/2000/svg", K = function(t) {
|
|
|
863
863
|
continue;
|
|
864
864
|
Mt(t, e, C, w, s);
|
|
865
865
|
}
|
|
866
|
-
},
|
|
867
|
-
side:
|
|
868
|
-
left:
|
|
869
|
-
right:
|
|
870
|
-
full:
|
|
871
|
-
living:
|
|
872
|
-
zoomin:
|
|
873
|
-
zoomout:
|
|
866
|
+
}, He = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="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>', Ie = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="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>', Oe = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="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>', Be = '<?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>', We = '<?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>', Ye = '<?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>', Re = '<?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>', Xe = {
|
|
867
|
+
side: He,
|
|
868
|
+
left: Ie,
|
|
869
|
+
right: Oe,
|
|
870
|
+
full: Be,
|
|
871
|
+
living: We,
|
|
872
|
+
zoomin: Ye,
|
|
873
|
+
zoomout: Re
|
|
874
874
|
}, H = (t, e) => {
|
|
875
875
|
const n = document.createElement("span");
|
|
876
|
-
return n.id = t, n.innerHTML =
|
|
876
|
+
return n.id = t, n.innerHTML = Xe[e], n;
|
|
877
877
|
};
|
|
878
|
-
function
|
|
878
|
+
function Ve(t) {
|
|
879
879
|
const e = document.createElement("div"), n = H("fullscreen", "full"), o = H("toCenter", "living"), s = H("zoomout", "zoomout"), i = H("zoomin", "zoomin");
|
|
880
880
|
e.appendChild(n), e.appendChild(o), e.appendChild(s), e.appendChild(i), e.className = "mind-elixir-toolbar rb";
|
|
881
881
|
let r = null;
|
|
@@ -903,7 +903,7 @@ function Re(t) {
|
|
|
903
903
|
t.scale(t.scaleVal + t.scaleSensitivity);
|
|
904
904
|
}, e;
|
|
905
905
|
}
|
|
906
|
-
function
|
|
906
|
+
function ze(t) {
|
|
907
907
|
const e = document.createElement("div"), n = H("tbltl", "left"), o = H("tbltr", "right"), s = H("tblts", "side");
|
|
908
908
|
return e.appendChild(n), e.appendChild(o), e.appendChild(s), e.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
909
909
|
t.initLeft();
|
|
@@ -913,32 +913,44 @@ function Xe(t) {
|
|
|
913
913
|
t.initSide();
|
|
914
914
|
}, e;
|
|
915
915
|
}
|
|
916
|
-
function
|
|
917
|
-
t.container.append(
|
|
916
|
+
function Fe(t) {
|
|
917
|
+
t.container.append(Ve(t)), t.container.append(ze(t));
|
|
918
|
+
}
|
|
919
|
+
function Pt({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, containerHeight: a }) {
|
|
920
|
+
let f = e + n / 2;
|
|
921
|
+
const d = t + o / 2;
|
|
922
|
+
let p;
|
|
923
|
+
l === O.LHS ? p = i + r : p = i;
|
|
924
|
+
const w = s + c / 2, u = (1 - Math.abs(w - d) / a) * 0.25 * (n / 2);
|
|
925
|
+
return l === O.LHS ? f = f - n / 10 - u : f = f + n / 10 + u, `M ${f} ${d} Q ${f} ${w} ${p} ${w}`;
|
|
918
926
|
}
|
|
919
|
-
|
|
927
|
+
function kt({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, isFirst: a }) {
|
|
928
|
+
const f = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
929
|
+
let d = 0, p = 0;
|
|
930
|
+
a ? d = t + o / 2 : d = t + o;
|
|
931
|
+
const w = s + c;
|
|
932
|
+
let y = 0, u = 0, g = 0;
|
|
933
|
+
const b = Math.abs(d - w) / 300 * f;
|
|
934
|
+
return l === O.LHS ? (g = e, y = g + f, u = g - f, p = i + f, `M ${y} ${d} C ${g} ${d} ${g + b} ${w} ${u} ${w} H ${p}`) : (g = e + n, y = g - f, u = g + f, p = i + r - f, `M ${y} ${d} C ${g} ${d} ${g - b} ${w} ${u} ${w} H ${p}`);
|
|
935
|
+
}
|
|
936
|
+
const Ge = function(t, e = !0) {
|
|
937
|
+
const n = this.theme || G, s = (t.type || n.type) === "dark" ? et : G;
|
|
920
938
|
this.theme = {
|
|
921
|
-
...
|
|
939
|
+
...n,
|
|
922
940
|
...t,
|
|
923
|
-
cssVar: {
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
};
|
|
932
|
-
this.compact && (o["--node-gap-x"] = "15px", o["--node-gap-y"] = "2px", o["--main-gap-x"] = "30px", o["--main-gap-y"] = "6px");
|
|
933
|
-
const s = Object.keys(o);
|
|
934
|
-
for (let i = 0; i < s.length; i++) {
|
|
935
|
-
const r = s[i];
|
|
936
|
-
this.container.style.setProperty(r, o[r]);
|
|
941
|
+
cssVar: t.cssVar ? { ...n.cssVar, ...t.cssVar } : { ...s.cssVar }
|
|
942
|
+
}, this.generateMainBranch = this.theme.generateMainBranch || Pt, this.generateSubBranch = this.theme.generateSubBranch || kt;
|
|
943
|
+
const i = { ...this.theme.cssVar };
|
|
944
|
+
this.compact && (i["--node-gap-x"] = "15px", i["--node-gap-y"] = "2px", i["--main-gap-x"] = "30px", i["--main-gap-y"] = "6px");
|
|
945
|
+
const r = Object.keys(i);
|
|
946
|
+
for (let c = 0; c < r.length; c++) {
|
|
947
|
+
const l = r[c];
|
|
948
|
+
this.container.style.setProperty(l, i[l]);
|
|
937
949
|
}
|
|
938
950
|
e && this.refresh();
|
|
939
|
-
},
|
|
951
|
+
}, _e = function(t) {
|
|
940
952
|
this.compact = t, this.theme && this.changeTheme(this.theme);
|
|
941
|
-
},
|
|
953
|
+
}, qe = function(t) {
|
|
942
954
|
return {
|
|
943
955
|
dom: t,
|
|
944
956
|
moved: !1,
|
|
@@ -974,18 +986,18 @@ const ze = function(t, e = !0) {
|
|
|
974
986
|
}
|
|
975
987
|
};
|
|
976
988
|
}, gt = {
|
|
977
|
-
create:
|
|
978
|
-
},
|
|
979
|
-
function
|
|
989
|
+
create: qe
|
|
990
|
+
}, Nt = "#4dc4ff";
|
|
991
|
+
function At(t, e, n, o, s, i, r, c) {
|
|
980
992
|
return {
|
|
981
993
|
x: t / 8 + n * 3 / 8 + s * 3 / 8 + r / 8,
|
|
982
994
|
y: e / 8 + o * 3 / 8 + i * 3 / 8 + c / 8
|
|
983
995
|
};
|
|
984
996
|
}
|
|
985
|
-
function
|
|
997
|
+
function je(t, e, n) {
|
|
986
998
|
t && (t.dataset.x = e.toString(), t.dataset.y = n.toString(), K(t));
|
|
987
999
|
}
|
|
988
|
-
function
|
|
1000
|
+
function V(t, e, n, o, s) {
|
|
989
1001
|
D(t, {
|
|
990
1002
|
x1: e + "",
|
|
991
1003
|
y1: n + "",
|
|
@@ -1019,12 +1031,12 @@ function mt(t, e, n, o, s, i, r, c, l, a) {
|
|
|
1019
1031
|
}
|
|
1020
1032
|
}
|
|
1021
1033
|
}
|
|
1022
|
-
const { x: w, y } =
|
|
1023
|
-
if (t.labelEl &&
|
|
1034
|
+
const { x: w, y } = At(e, n, o, s, i, r, c, l);
|
|
1035
|
+
if (t.labelEl && je(t.labelEl, w, y), a.style?.labelColor) {
|
|
1024
1036
|
const u = t.labelEl;
|
|
1025
1037
|
u && (u.style.color = a.style.labelColor);
|
|
1026
1038
|
}
|
|
1027
|
-
|
|
1039
|
+
nn(t);
|
|
1028
1040
|
}
|
|
1029
1041
|
function j(t, e, n) {
|
|
1030
1042
|
const { offsetLeft: o, offsetTop: s } = P(t.nodes, e), i = e.offsetWidth, r = e.offsetHeight, c = o + i / 2, l = s + r / 2, a = c + n.x, f = l + n.y;
|
|
@@ -1045,7 +1057,7 @@ function I(t) {
|
|
|
1045
1057
|
y: n
|
|
1046
1058
|
};
|
|
1047
1059
|
}
|
|
1048
|
-
const
|
|
1060
|
+
const Ue = function(t, e, n) {
|
|
1049
1061
|
const o = P(t.nodes, e), s = P(t.nodes, n), i = o.offsetLeft + e.offsetWidth / 2, r = o.offsetTop + e.offsetHeight / 2, c = s.offsetLeft + n.offsetWidth / 2, l = s.offsetTop + n.offsetHeight / 2, a = c - i, f = l - r, d = Math.sqrt(a * a + f * f), p = Math.max(50, Math.min(200, d * 0.3)), w = Math.abs(a), y = Math.abs(f);
|
|
1050
1062
|
let u, g;
|
|
1051
1063
|
if (d < 150) {
|
|
@@ -1069,7 +1081,7 @@ const qe = function(t, e, n) {
|
|
|
1069
1081
|
if (!e || !n)
|
|
1070
1082
|
return;
|
|
1071
1083
|
if (!o.delta1 || !o.delta2) {
|
|
1072
|
-
const S =
|
|
1084
|
+
const S = Ue(t, e, n);
|
|
1073
1085
|
o.delta1 = S.delta1, o.delta2 = S.delta2;
|
|
1074
1086
|
}
|
|
1075
1087
|
const i = j(t, e, o.delta1), r = j(t, n, o.delta2), { x: c, y: l } = I(i), { ctrlX: a, ctrlY: f } = i, { ctrlX: d, ctrlY: p } = r, { x: w, y } = I(r), u = q(d, p, w, y);
|
|
@@ -1081,7 +1093,7 @@ const qe = function(t, e, n) {
|
|
|
1081
1093
|
if (!S) return;
|
|
1082
1094
|
b = `M ${S.x1} ${S.y1} L ${c} ${l} L ${S.x2} ${S.y2}`;
|
|
1083
1095
|
}
|
|
1084
|
-
const v =
|
|
1096
|
+
const v = Ae(`M ${c} ${l} C ${a} ${f} ${d} ${p} ${w} ${y}`, g, b, o.style), { x: C, y: T } = At(c, l, a, f, d, p, w, y), h = o.style?.labelColor || "rgb(235, 95, 82)", m = "a-" + o.id;
|
|
1085
1097
|
v.id = m;
|
|
1086
1098
|
const x = t.markdown ? t.markdown(o.label, o) : o.label, E = tt(x, C, T, {
|
|
1087
1099
|
anchor: "middle",
|
|
@@ -1089,10 +1101,10 @@ const qe = function(t, e, n) {
|
|
|
1089
1101
|
dataType: "arrow",
|
|
1090
1102
|
svgId: m
|
|
1091
1103
|
});
|
|
1092
|
-
v.labelEl = E, v.arrowObj = o, v.dataset.linkid = o.id, t.labelContainer.appendChild(E), t.arrowSvg.appendChild(v), K(E), s || (t.arrows.push(o), t.currentArrow = v,
|
|
1093
|
-
},
|
|
1104
|
+
v.labelEl = E, v.arrowObj = o, v.dataset.linkid = o.id, t.labelContainer.appendChild(E), t.arrowSvg.appendChild(v), K(E), s || (t.arrows.push(o), t.currentArrow = v, Ht(t, o, i, r));
|
|
1105
|
+
}, Ke = function(t, e, n = {}) {
|
|
1094
1106
|
const o = {
|
|
1095
|
-
id:
|
|
1107
|
+
id: Y(),
|
|
1096
1108
|
label: "Custom Link",
|
|
1097
1109
|
from: t.nodeObj.id,
|
|
1098
1110
|
to: e.nodeObj.id,
|
|
@@ -1102,14 +1114,14 @@ const qe = function(t, e, n) {
|
|
|
1102
1114
|
name: "createArrow",
|
|
1103
1115
|
obj: o
|
|
1104
1116
|
});
|
|
1105
|
-
},
|
|
1117
|
+
}, Je = function(t) {
|
|
1106
1118
|
J(this);
|
|
1107
|
-
const e = { ...t, id:
|
|
1119
|
+
const e = { ...t, id: Y() };
|
|
1108
1120
|
it(this, this.findEle(e.from), this.findEle(e.to), e), this.bus.fire("operation", {
|
|
1109
1121
|
name: "createArrow",
|
|
1110
1122
|
obj: e
|
|
1111
1123
|
});
|
|
1112
|
-
},
|
|
1124
|
+
}, Ze = function(t) {
|
|
1113
1125
|
let e;
|
|
1114
1126
|
if (t ? e = t : e = this.currentArrow, !e) return;
|
|
1115
1127
|
J(this);
|
|
@@ -1120,11 +1132,11 @@ const qe = function(t, e, n) {
|
|
|
1120
1132
|
id: n
|
|
1121
1133
|
}
|
|
1122
1134
|
});
|
|
1123
|
-
},
|
|
1135
|
+
}, Qe = function(t) {
|
|
1124
1136
|
this.currentArrow = t;
|
|
1125
1137
|
const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), s = j(this, n, e.delta1), i = j(this, o, e.delta2);
|
|
1126
|
-
this.editable ?
|
|
1127
|
-
},
|
|
1138
|
+
this.editable ? Ht(this, e, s, i) : $t(t, Nt), this.bus.fire("selectArrow", e);
|
|
1139
|
+
}, tn = function() {
|
|
1128
1140
|
J(this), this.currentArrow = null, this.bus.fire("unselectArrow");
|
|
1129
1141
|
}, Q = function(t, e) {
|
|
1130
1142
|
const n = document.createElementNS(k, "path");
|
|
@@ -1136,7 +1148,7 @@ const qe = function(t, e, n) {
|
|
|
1136
1148
|
"stroke-linecap": "round",
|
|
1137
1149
|
"stroke-linejoin": "round"
|
|
1138
1150
|
}), n;
|
|
1139
|
-
},
|
|
1151
|
+
}, $t = function(t, e) {
|
|
1140
1152
|
const n = document.createElementNS(k, "g");
|
|
1141
1153
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
1142
1154
|
const o = Q(t.line.getAttribute("d"), e);
|
|
@@ -1147,32 +1159,32 @@ const qe = function(t, e, n) {
|
|
|
1147
1159
|
n.appendChild(i);
|
|
1148
1160
|
}
|
|
1149
1161
|
t.insertBefore(n, t.firstChild);
|
|
1150
|
-
},
|
|
1162
|
+
}, en = function(t) {
|
|
1151
1163
|
const e = t.querySelector(".arrow-highlight");
|
|
1152
1164
|
e && e.remove();
|
|
1153
|
-
},
|
|
1165
|
+
}, nn = function(t) {
|
|
1154
1166
|
const e = t.querySelector(".arrow-highlight");
|
|
1155
1167
|
if (!e) return;
|
|
1156
1168
|
const n = e.querySelectorAll("path");
|
|
1157
1169
|
n.length >= 1 && n[0].setAttribute("d", t.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", t.arrow1.getAttribute("d")), n.length >= 3 && t.arrow2.getAttribute("d") && n[2].setAttribute("d", t.arrow2.getAttribute("d"));
|
|
1158
1170
|
}, J = function(t) {
|
|
1159
|
-
t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow &&
|
|
1160
|
-
},
|
|
1171
|
+
t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow && en(t.currentArrow);
|
|
1172
|
+
}, Ht = function(t, e, n, o) {
|
|
1161
1173
|
const { linkController: s, P2: i, P3: r, line1: c, line2: l, nodes: a, map: f, currentArrow: d, bus: p } = t;
|
|
1162
1174
|
if (!d) return;
|
|
1163
|
-
s.style.display = "initial", i.style.display = "initial", r.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(r),
|
|
1175
|
+
s.style.display = "initial", i.style.display = "initial", r.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(r), $t(d, Nt);
|
|
1164
1176
|
let { x: w, y } = I(n), { ctrlX: u, ctrlY: g } = n, { ctrlX: b, ctrlY: v } = o, { x: C, y: T } = I(o);
|
|
1165
|
-
i.style.cssText = `top:${g}px;left:${u}px;`, r.style.cssText = `top:${v}px;left:${b}px;`,
|
|
1177
|
+
i.style.cssText = `top:${g}px;left:${u}px;`, r.style.cssText = `top:${v}px;left:${b}px;`, V(c, w, y, u, g), V(l, b, v, C, T), t.helper1 = gt.create(i), t.helper2 = gt.create(r), t.helper1.init(f, (h, m) => {
|
|
1166
1178
|
u = u + h / t.scaleVal, g = g + m / t.scaleVal;
|
|
1167
1179
|
const x = I({ ...n, ctrlX: u, ctrlY: g });
|
|
1168
|
-
w = x.x, y = x.y, i.style.top = g + "px", i.style.left = u + "px", mt(d, w, y, u, g, b, v, C, T, e),
|
|
1180
|
+
w = x.x, y = x.y, i.style.top = g + "px", i.style.left = u + "px", mt(d, w, y, u, g, b, v, C, T, e), V(c, w, y, u, g), e.delta1.x = Math.round(u - n.cx), e.delta1.y = Math.round(g - n.cy), p.fire("updateArrowDelta", e);
|
|
1169
1181
|
}), t.helper2.init(f, (h, m) => {
|
|
1170
1182
|
b = b + h / t.scaleVal, v = v + m / t.scaleVal;
|
|
1171
1183
|
const x = I({ ...o, ctrlX: b, ctrlY: v });
|
|
1172
|
-
C = x.x, T = x.y, r.style.top = v + "px", r.style.left = b + "px", mt(d, w, y, u, g, b, v, C, T, e),
|
|
1184
|
+
C = x.x, T = x.y, r.style.top = v + "px", r.style.left = b + "px", mt(d, w, y, u, g, b, v, C, T, e), V(l, b, v, C, T), e.delta2.x = Math.round(b - o.cx), e.delta2.y = Math.round(v - o.cy), p.fire("updateArrowDelta", e);
|
|
1173
1185
|
});
|
|
1174
1186
|
};
|
|
1175
|
-
function
|
|
1187
|
+
function on() {
|
|
1176
1188
|
this.arrowSvg.innerHTML = "", this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach((e) => e.remove());
|
|
1177
1189
|
for (let e = 0; e < this.arrows.length; e++) {
|
|
1178
1190
|
const n = this.arrows[e];
|
|
@@ -1183,23 +1195,23 @@ function en() {
|
|
|
1183
1195
|
}
|
|
1184
1196
|
this.nodes.appendChild(this.arrowSvg);
|
|
1185
1197
|
}
|
|
1186
|
-
function
|
|
1198
|
+
function sn(t) {
|
|
1187
1199
|
J(this), t && t.labelEl && Lt(this, t.labelEl, t.arrowObj);
|
|
1188
1200
|
}
|
|
1189
|
-
function
|
|
1201
|
+
function rn() {
|
|
1190
1202
|
this.arrows = this.arrows.filter((t) => _(t.from, this.nodeData) && _(t.to, this.nodeData));
|
|
1191
1203
|
}
|
|
1192
|
-
const
|
|
1204
|
+
const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1193
1205
|
__proto__: null,
|
|
1194
|
-
createArrow:
|
|
1195
|
-
createArrowFrom:
|
|
1196
|
-
editArrowLabel:
|
|
1197
|
-
removeArrow:
|
|
1198
|
-
renderArrow:
|
|
1199
|
-
selectArrow:
|
|
1200
|
-
tidyArrow:
|
|
1201
|
-
unselectArrow:
|
|
1202
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1206
|
+
createArrow: Ke,
|
|
1207
|
+
createArrowFrom: Je,
|
|
1208
|
+
editArrowLabel: sn,
|
|
1209
|
+
removeArrow: Ze,
|
|
1210
|
+
renderArrow: on,
|
|
1211
|
+
selectArrow: Qe,
|
|
1212
|
+
tidyArrow: rn,
|
|
1213
|
+
unselectArrow: tn
|
|
1214
|
+
}, Symbol.toStringTag, { value: "Module" })), ln = function(t) {
|
|
1203
1215
|
if (t.length === 0) throw new Error("No selected node.");
|
|
1204
1216
|
if (t.length === 1) {
|
|
1205
1217
|
const l = t[0].nodeObj, a = t[0].nodeObj.parent;
|
|
@@ -1236,7 +1248,7 @@ const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1236
1248
|
start: i,
|
|
1237
1249
|
end: r
|
|
1238
1250
|
};
|
|
1239
|
-
},
|
|
1251
|
+
}, an = function(t) {
|
|
1240
1252
|
const e = document.createElementNS(k, "g");
|
|
1241
1253
|
return e.setAttribute("id", t), e;
|
|
1242
1254
|
}, yt = function(t, e) {
|
|
@@ -1248,69 +1260,69 @@ const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1248
1260
|
"stroke-linecap": "round",
|
|
1249
1261
|
"stroke-width": "2"
|
|
1250
1262
|
}), n;
|
|
1251
|
-
},
|
|
1263
|
+
}, hn = (t) => t.parentElement.parentElement, dn = function(t, { parent: e, start: n }) {
|
|
1252
1264
|
const o = t.findEle(e), s = o.nodeObj;
|
|
1253
1265
|
let i;
|
|
1254
1266
|
return s.parent ? i = o.closest("me-main").className : i = t.findEle(s.children[n].id).closest("me-main").className, i;
|
|
1255
1267
|
}, rt = function(t, e) {
|
|
1256
|
-
const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes: l, theme: a, summarySvg: f } = t, p = t.findEle(s).nodeObj, w =
|
|
1268
|
+
const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes: l, theme: a, summarySvg: f } = t, p = t.findEle(s).nodeObj, w = dn(t, e);
|
|
1257
1269
|
let y = 1 / 0, u = 0, g = 0, b = 0;
|
|
1258
1270
|
for (let B = i; B <= r; B++) {
|
|
1259
1271
|
const ct = p.children?.[B];
|
|
1260
1272
|
if (!ct)
|
|
1261
1273
|
return t.removeSummary(n), null;
|
|
1262
|
-
const
|
|
1263
|
-
B === i && (g = lt + at), B === r && (b = lt +
|
|
1274
|
+
const R = hn(t.findEle(ct.id)), { offsetLeft: X, offsetTop: lt } = P(l, R), at = i === r ? 10 : 20;
|
|
1275
|
+
B === i && (g = lt + at), B === r && (b = lt + R.offsetHeight - at), X < y && (y = X), R.offsetWidth + X > u && (u = R.offsetWidth + X);
|
|
1264
1276
|
}
|
|
1265
1277
|
let v, C;
|
|
1266
1278
|
const T = p.parent ? 10 : 0, h = g + T, m = b + T, x = (h + m) / 2, E = c?.stroke || a.cssVar["--color"], S = c?.labelColor || a.cssVar["--color"], M = "s-" + n, N = t.markdown ? t.markdown(o, e) : o;
|
|
1267
1279
|
w === O.LHS ? (v = yt(`M ${y + 10} ${h} c -5 0 -10 5 -10 10 L ${y} ${m - 10} c 0 5 5 10 10 10 M ${y} ${x} h -10`, E), C = tt(N, y - 20, x, { anchor: "end", color: S, dataType: "summary", svgId: M })) : (v = yt(`M ${u - 10} ${h} c 5 0 10 5 10 10 L ${u} ${m - 10} c 0 5 -5 10 -10 10 M ${u} ${x} h 10`, E), C = tt(N, u + 20, x, { anchor: "start", color: S, dataType: "summary", svgId: M }));
|
|
1268
|
-
const $ =
|
|
1280
|
+
const $ = an(M);
|
|
1269
1281
|
return $.appendChild(v), t.labelContainer.appendChild(C), K(C), $.summaryObj = e, $.labelEl = C, f.appendChild($), $;
|
|
1270
|
-
},
|
|
1282
|
+
}, fn = function(t = {}) {
|
|
1271
1283
|
if (!this.currentNodes) return;
|
|
1272
|
-
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } =
|
|
1284
|
+
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } = ln(e), c = { id: Y(), parent: s, start: i, end: r, label: "summary", style: t.style }, l = rt(this, c);
|
|
1273
1285
|
n.push(c), this.editSummary(l), o.fire("operation", {
|
|
1274
1286
|
name: "createSummary",
|
|
1275
1287
|
obj: c
|
|
1276
1288
|
});
|
|
1277
|
-
},
|
|
1278
|
-
const e =
|
|
1289
|
+
}, un = function(t) {
|
|
1290
|
+
const e = Y(), n = { ...t, id: e };
|
|
1279
1291
|
rt(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
1280
1292
|
name: "createSummary",
|
|
1281
1293
|
obj: n
|
|
1282
1294
|
});
|
|
1283
|
-
},
|
|
1295
|
+
}, pn = function(t) {
|
|
1284
1296
|
const e = this.summaries.findIndex((n) => n.id === t);
|
|
1285
1297
|
e > -1 && (this.summaries.splice(e, 1), this.nodes.querySelector("#s-" + t)?.remove(), this.nodes.querySelector("#label-s-" + t)?.remove()), this.bus.fire("operation", {
|
|
1286
1298
|
name: "removeSummary",
|
|
1287
1299
|
obj: { id: t }
|
|
1288
1300
|
});
|
|
1289
|
-
},
|
|
1301
|
+
}, gn = function(t) {
|
|
1290
1302
|
const e = t.labelEl;
|
|
1291
1303
|
e && e.classList.add("selected"), this.currentSummary = t, this.bus.fire("selectSummary", t.summaryObj);
|
|
1292
|
-
},
|
|
1304
|
+
}, mn = function() {
|
|
1293
1305
|
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null, this.bus.fire("unselectSummary");
|
|
1294
|
-
},
|
|
1306
|
+
}, yn = function() {
|
|
1295
1307
|
this.summarySvg.innerHTML = "", this.summaries.forEach((t) => {
|
|
1296
1308
|
try {
|
|
1297
1309
|
rt(this, t);
|
|
1298
1310
|
} catch {
|
|
1299
1311
|
}
|
|
1300
1312
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
1301
|
-
},
|
|
1313
|
+
}, wn = function(t) {
|
|
1302
1314
|
t && t.labelEl && Lt(this, t.labelEl, t.summaryObj);
|
|
1303
|
-
},
|
|
1315
|
+
}, vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1304
1316
|
__proto__: null,
|
|
1305
|
-
createSummary:
|
|
1306
|
-
createSummaryFrom:
|
|
1307
|
-
editSummary:
|
|
1308
|
-
removeSummary:
|
|
1309
|
-
renderSummary:
|
|
1310
|
-
selectSummary:
|
|
1311
|
-
unselectSummary:
|
|
1317
|
+
createSummary: fn,
|
|
1318
|
+
createSummaryFrom: un,
|
|
1319
|
+
editSummary: wn,
|
|
1320
|
+
removeSummary: pn,
|
|
1321
|
+
renderSummary: yn,
|
|
1322
|
+
selectSummary: gn,
|
|
1323
|
+
unselectSummary: mn
|
|
1312
1324
|
}, Symbol.toStringTag, { value: "Module" })), L = "http://www.w3.org/2000/svg";
|
|
1313
|
-
function
|
|
1325
|
+
function bn(t, e) {
|
|
1314
1326
|
const n = document.createElementNS(L, "svg");
|
|
1315
1327
|
return D(n, {
|
|
1316
1328
|
version: "1.1",
|
|
@@ -1319,10 +1331,10 @@ function wn(t, e) {
|
|
|
1319
1331
|
width: e
|
|
1320
1332
|
}), n;
|
|
1321
1333
|
}
|
|
1322
|
-
function
|
|
1334
|
+
function xn(t, e) {
|
|
1323
1335
|
return (parseInt(t) - parseInt(e)) / 2;
|
|
1324
1336
|
}
|
|
1325
|
-
function
|
|
1337
|
+
function Cn(t, e, n, o) {
|
|
1326
1338
|
const s = document.createElementNS(L, "g");
|
|
1327
1339
|
let i = "";
|
|
1328
1340
|
return t.text ? i = t.text.textContent : i = t.childNodes[0].textContent, i.split(`
|
|
@@ -1330,7 +1342,7 @@ function bn(t, e, n, o) {
|
|
|
1330
1342
|
const a = document.createElementNS(L, "text");
|
|
1331
1343
|
D(a, {
|
|
1332
1344
|
x: n + parseInt(e.paddingLeft) + "",
|
|
1333
|
-
y: o + parseInt(e.paddingTop) +
|
|
1345
|
+
y: o + parseInt(e.paddingTop) + xn(e.lineHeight, e.fontSize) * (l + 1) + parseFloat(e.fontSize) * (l + 1) + "",
|
|
1334
1346
|
"text-anchor": "start",
|
|
1335
1347
|
"font-family": e.fontFamily,
|
|
1336
1348
|
"font-size": `${e.fontSize}`,
|
|
@@ -1339,7 +1351,7 @@ function bn(t, e, n, o) {
|
|
|
1339
1351
|
}), a.innerHTML = c, s.appendChild(a);
|
|
1340
1352
|
}), s;
|
|
1341
1353
|
}
|
|
1342
|
-
function
|
|
1354
|
+
function Sn(t, e, n, o) {
|
|
1343
1355
|
let s = "";
|
|
1344
1356
|
t.nodeObj?.dangerouslySetInnerHTML ? s = t.nodeObj.dangerouslySetInnerHTML : t.text ? s = t.text.textContent : s = t.childNodes[0].textContent;
|
|
1345
1357
|
const i = document.createElementNS(L, "foreignObject");
|
|
@@ -1355,7 +1367,7 @@ function xn(t, e, n, o) {
|
|
|
1355
1367
|
style: `font-family: ${e.fontFamily}; font-size: ${e.fontSize}; font-weight: ${e.fontWeight}; color: ${e.color}; white-space: pre-wrap;`
|
|
1356
1368
|
}), r.innerHTML = s, i.appendChild(r), i;
|
|
1357
1369
|
}
|
|
1358
|
-
function
|
|
1370
|
+
function En(t, e) {
|
|
1359
1371
|
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = P(t.nodes, e), i = document.createElementNS(L, "rect");
|
|
1360
1372
|
return D(i, {
|
|
1361
1373
|
x: o + "",
|
|
@@ -1369,7 +1381,7 @@ function Cn(t, e) {
|
|
|
1369
1381
|
"stroke-width": n.borderWidth
|
|
1370
1382
|
}), i;
|
|
1371
1383
|
}
|
|
1372
|
-
function
|
|
1384
|
+
function z(t, e, n = !1) {
|
|
1373
1385
|
const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } = P(t.nodes, e), r = document.createElementNS(L, "rect");
|
|
1374
1386
|
D(r, {
|
|
1375
1387
|
x: s + "",
|
|
@@ -1385,9 +1397,9 @@ function F(t, e, n = !1) {
|
|
|
1385
1397
|
const c = document.createElementNS(L, "g");
|
|
1386
1398
|
c.appendChild(r);
|
|
1387
1399
|
let l;
|
|
1388
|
-
return n ? l =
|
|
1400
|
+
return n ? l = Sn(e, o, s, i) : l = Cn(e, o, s, i), c.appendChild(l), c;
|
|
1389
1401
|
}
|
|
1390
|
-
function
|
|
1402
|
+
function Tn(t, e) {
|
|
1391
1403
|
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = P(t.nodes, e), i = document.createElementNS(L, "a"), r = document.createElementNS(L, "text");
|
|
1392
1404
|
return D(r, {
|
|
1393
1405
|
x: o + "",
|
|
@@ -1399,7 +1411,7 @@ function Sn(t, e) {
|
|
|
1399
1411
|
fill: `${n.color}`
|
|
1400
1412
|
}), r.innerHTML = e.textContent, i.appendChild(r), i.setAttribute("href", e.href), i;
|
|
1401
1413
|
}
|
|
1402
|
-
function
|
|
1414
|
+
function Dn(t, e) {
|
|
1403
1415
|
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = P(t.nodes, e), i = document.createElementNS(L, "image");
|
|
1404
1416
|
return D(i, {
|
|
1405
1417
|
x: o + "",
|
|
@@ -1409,8 +1421,8 @@ function En(t, e) {
|
|
|
1409
1421
|
href: e.src
|
|
1410
1422
|
}), i;
|
|
1411
1423
|
}
|
|
1412
|
-
const
|
|
1413
|
-
const n = t.nodes, o = n.offsetHeight +
|
|
1424
|
+
const F = 100, Ln = '<?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">', Mn = (t, e = !1) => {
|
|
1425
|
+
const n = t.nodes, o = n.offsetHeight + F * 2, s = n.offsetWidth + F * 2, i = bn(o + "px", s + "px"), r = document.createElementNS(L, "svg"), c = document.createElementNS(L, "rect");
|
|
1414
1426
|
D(c, {
|
|
1415
1427
|
x: "0",
|
|
1416
1428
|
y: "0",
|
|
@@ -1427,22 +1439,22 @@ const G = 100, Tn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "
|
|
|
1427
1439
|
a && r.appendChild(a);
|
|
1428
1440
|
const f = n.querySelector(".summary")?.cloneNode(!0);
|
|
1429
1441
|
return f && r.appendChild(f), n.querySelectorAll("me-tpc").forEach((d) => {
|
|
1430
|
-
d.nodeObj.dangerouslySetInnerHTML ? r.appendChild(
|
|
1442
|
+
d.nodeObj.dangerouslySetInnerHTML ? r.appendChild(z(t, d, !e)) : (r.appendChild(En(t, d)), r.appendChild(z(t, d.text, !e)));
|
|
1431
1443
|
}), n.querySelectorAll(".tags > span").forEach((d) => {
|
|
1432
|
-
r.appendChild(
|
|
1444
|
+
r.appendChild(z(t, d));
|
|
1433
1445
|
}), n.querySelectorAll(".icons > span").forEach((d) => {
|
|
1434
|
-
r.appendChild(
|
|
1446
|
+
r.appendChild(z(t, d));
|
|
1435
1447
|
}), n.querySelectorAll(".hyper-link").forEach((d) => {
|
|
1436
|
-
r.appendChild(
|
|
1448
|
+
r.appendChild(Tn(t, d));
|
|
1437
1449
|
}), n.querySelectorAll("img").forEach((d) => {
|
|
1438
|
-
r.appendChild(
|
|
1450
|
+
r.appendChild(Dn(t, d));
|
|
1439
1451
|
}), D(r, {
|
|
1440
|
-
x:
|
|
1441
|
-
y:
|
|
1452
|
+
x: F + "",
|
|
1453
|
+
y: F + "",
|
|
1442
1454
|
overflow: "visible"
|
|
1443
1455
|
}), i.appendChild(r), i;
|
|
1444
|
-
},
|
|
1445
|
-
function
|
|
1456
|
+
}, Pn = (t, e) => (e && t.insertAdjacentHTML("afterbegin", "<style>" + e + "</style>"), Ln + t.outerHTML);
|
|
1457
|
+
function kn(t) {
|
|
1446
1458
|
return new Promise((e, n) => {
|
|
1447
1459
|
const o = new FileReader();
|
|
1448
1460
|
o.onload = (s) => {
|
|
@@ -1452,11 +1464,11 @@ function Mn(t) {
|
|
|
1452
1464
|
}, o.readAsDataURL(t);
|
|
1453
1465
|
});
|
|
1454
1466
|
}
|
|
1455
|
-
const
|
|
1456
|
-
const n =
|
|
1467
|
+
const Nn = function(t = !1, e) {
|
|
1468
|
+
const n = Mn(this, t), o = Pn(n, e);
|
|
1457
1469
|
return new Blob([o], { type: "image/svg+xml" });
|
|
1458
|
-
},
|
|
1459
|
-
const n = this.exportSvg(t, e), o = await
|
|
1470
|
+
}, An = async function(t = !1, e) {
|
|
1471
|
+
const n = this.exportSvg(t, e), o = await kn(n);
|
|
1460
1472
|
return new Promise((s, i) => {
|
|
1461
1473
|
const r = new Image();
|
|
1462
1474
|
r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
|
|
@@ -1464,31 +1476,31 @@ const Pn = function(t = !1, e) {
|
|
|
1464
1476
|
c.width = r.width, c.height = r.height, c.getContext("2d").drawImage(r, 0, 0), c.toBlob(s, "image/png", 1);
|
|
1465
1477
|
}, r.src = o, r.onerror = i;
|
|
1466
1478
|
});
|
|
1467
|
-
},
|
|
1479
|
+
}, $n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1468
1480
|
__proto__: null,
|
|
1469
|
-
exportPng:
|
|
1470
|
-
exportSvg:
|
|
1471
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1481
|
+
exportPng: An,
|
|
1482
|
+
exportSvg: Nn
|
|
1483
|
+
}, Symbol.toStringTag, { value: "Module" })), Hn = {}, In = {
|
|
1472
1484
|
getObjById: _,
|
|
1473
|
-
generateNewObj:
|
|
1474
|
-
layout:
|
|
1475
|
-
linkDiv:
|
|
1476
|
-
editTopic:
|
|
1477
|
-
createWrapper:
|
|
1478
|
-
createParent:
|
|
1479
|
-
createChildren:
|
|
1480
|
-
createTopic:
|
|
1485
|
+
generateNewObj: Ot,
|
|
1486
|
+
layout: Ft,
|
|
1487
|
+
linkDiv: $e,
|
|
1488
|
+
editTopic: Jt,
|
|
1489
|
+
createWrapper: qt,
|
|
1490
|
+
createParent: jt,
|
|
1491
|
+
createChildren: Ut,
|
|
1492
|
+
createTopic: Kt,
|
|
1481
1493
|
findEle: Ct,
|
|
1482
|
-
changeTheme:
|
|
1483
|
-
changeCompact:
|
|
1484
|
-
...
|
|
1485
|
-
...
|
|
1486
|
-
...
|
|
1487
|
-
...
|
|
1488
|
-
|
|
1494
|
+
changeTheme: Ge,
|
|
1495
|
+
changeCompact: _e,
|
|
1496
|
+
...Se,
|
|
1497
|
+
...Hn,
|
|
1498
|
+
...cn,
|
|
1499
|
+
...vn,
|
|
1500
|
+
...$n,
|
|
1489
1501
|
init(t) {
|
|
1490
1502
|
if (t = JSON.parse(JSON.stringify(t)), !t || !t.nodeData) return new Error("MindElixir: `data` is required");
|
|
1491
|
-
t.direction !== void 0 && (this.direction = t.direction), t.compact !== void 0 && (this.compact = t.compact), this.changeTheme(t.theme || this.theme, !1), t.meta && (this.meta = t.meta), this.nodeData = t.nodeData, nt(this.nodeData), this.arrows = t.arrows || [], this.summaries = t.summaries || [], this.tidyArrow(), this.toolBar &&
|
|
1503
|
+
t.direction !== void 0 && (this.direction = t.direction), t.compact !== void 0 && (this.compact = t.compact), this.changeTheme(t.theme || this.theme, !1), t.meta && (this.meta = t.meta), this.nodeData = t.nodeData, nt(this.nodeData), this.arrows = t.arrows || [], this.summaries = t.summaries || [], this.tidyArrow(), this.toolBar && Fe(this), this.layout(), this.linkDiv(), this.toCenter();
|
|
1492
1504
|
},
|
|
1493
1505
|
destroy() {
|
|
1494
1506
|
this.disposable.forEach((t) => t()), this.el && (this.el.innerHTML = ""), this.el = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.arrowSvg = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, this.selection?.destroy(), this.selection = void 0;
|
|
@@ -1500,25 +1512,7 @@ const Pn = function(t = !1, e) {
|
|
|
1500
1512
|
enableMobileMultiSelect(t) {
|
|
1501
1513
|
this.mobileMultiSelect = t;
|
|
1502
1514
|
}
|
|
1503
|
-
};
|
|
1504
|
-
function Hn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, containerHeight: a }) {
|
|
1505
|
-
let f = e + n / 2;
|
|
1506
|
-
const d = t + o / 2;
|
|
1507
|
-
let p;
|
|
1508
|
-
l === O.LHS ? p = i + r : p = i;
|
|
1509
|
-
const w = s + c / 2, u = (1 - Math.abs(w - d) / a) * 0.25 * (n / 2);
|
|
1510
|
-
return l === O.LHS ? f = f - n / 10 - u : f = f + n / 10 + u, `M ${f} ${d} Q ${f} ${w} ${p} ${w}`;
|
|
1511
|
-
}
|
|
1512
|
-
function In({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, isFirst: a }) {
|
|
1513
|
-
const f = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
1514
|
-
let d = 0, p = 0;
|
|
1515
|
-
a ? d = t + o / 2 : d = t + o;
|
|
1516
|
-
const w = s + c;
|
|
1517
|
-
let y = 0, u = 0, g = 0;
|
|
1518
|
-
const b = Math.abs(d - w) / 300 * f;
|
|
1519
|
-
return l === O.LHS ? (g = e, y = g + f, u = g - f, p = i + f, `M ${y} ${d} C ${g} ${d} ${g + b} ${w} ${u} ${w} H ${p}`) : (g = e + n, y = g - f, u = g + f, p = i + r - f, `M ${y} ${d} C ${g} ${d} ${g - b} ${w} ${u} ${w} H ${p}`);
|
|
1520
|
-
}
|
|
1521
|
-
const On = "5.12.2-beta.1";
|
|
1515
|
+
}, On = "5.12.2-beta.3";
|
|
1522
1516
|
function Bn(t) {
|
|
1523
1517
|
return {
|
|
1524
1518
|
x: 0,
|
|
@@ -1576,13 +1570,13 @@ function A({
|
|
|
1576
1570
|
let S = null;
|
|
1577
1571
|
const M = Object.prototype.toString.call(t);
|
|
1578
1572
|
if (M === "[object HTMLDivElement]" ? S = t : M === "[object String]" && (S = document.querySelector(t)), !S) throw new Error("MindElixir: el is not a valid element");
|
|
1579
|
-
S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before = l || {}, this.newTopicName = a || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = r ?? 0, this.direction = e ?? 1, this.editable = n ?? !0, this.allowUndo = f ?? !0, this.scaleSensitivity = b ?? 0.1, this.scaleMax = v ?? 1.4, this.scaleMin = C ?? 0.2, this.generateMainBranch = d ||
|
|
1573
|
+
S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before = l || {}, this.newTopicName = a || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = r ?? 0, this.direction = e ?? 1, this.editable = n ?? !0, this.allowUndo = f ?? !0, this.scaleSensitivity = b ?? 0.1, this.scaleMax = v ?? 1.4, this.scaleMin = C ?? 0.2, this.generateMainBranch = d || Pt, this.generateSubBranch = p || kt, this.overflowHidden = w ?? !1, this.compact = y ?? !1, this.alignment = g ?? "root", this.handleWheel = T ?? !0, this.markdown = h || void 0, this.imageProxy = m || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.mobileMultiSelect = E ?? !1, this.panHelper = Bn(this), this.bus = Ne(), this.container = document.createElement("div"), this.selectionContainer = c || this.container, this.container.className = "map-container";
|
|
1580
1574
|
const N = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1581
|
-
this.theme = u || (N.matches ? et :
|
|
1575
|
+
this.theme = u || (N.matches ? et : G);
|
|
1582
1576
|
const $ = document.createElement("div");
|
|
1583
|
-
$.className = "map-canvas", this.map = $, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines = W("lines"), this.summarySvg = W("summary"), this.linkController = W("linkcontroller"), this.P2 = document.createElement("div"), this.P3 = document.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = pt(), this.line2 = pt(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.arrowSvg = W("topiclinks"), this.labelContainer = document.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(
|
|
1577
|
+
$.className = "map-canvas", this.map = $, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines = W("lines"), this.summarySvg = W("summary"), this.linkController = W("linkcontroller"), this.P2 = document.createElement("div"), this.P3 = document.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = pt(), this.line2 = pt(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.arrowSvg = W("topiclinks"), this.labelContainer = document.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(ke(this)), x && (this.pasteHandler = x);
|
|
1584
1578
|
}
|
|
1585
|
-
A.prototype =
|
|
1579
|
+
A.prototype = In;
|
|
1586
1580
|
Object.defineProperty(A.prototype, "currentNode", {
|
|
1587
1581
|
get() {
|
|
1588
1582
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
@@ -1592,7 +1586,7 @@ Object.defineProperty(A.prototype, "currentNode", {
|
|
|
1592
1586
|
A.LEFT = 0;
|
|
1593
1587
|
A.RIGHT = 1;
|
|
1594
1588
|
A.SIDE = 2;
|
|
1595
|
-
A.THEME =
|
|
1589
|
+
A.THEME = G;
|
|
1596
1590
|
A.DARK_THEME = et;
|
|
1597
1591
|
A.version = On;
|
|
1598
1592
|
A.E = Ct;
|
|
@@ -1601,6 +1595,6 @@ export {
|
|
|
1601
1595
|
Wn as LEFT,
|
|
1602
1596
|
Yn as RIGHT,
|
|
1603
1597
|
Rn as SIDE,
|
|
1604
|
-
|
|
1598
|
+
G as THEME,
|
|
1605
1599
|
A as default
|
|
1606
1600
|
};
|