mind-elixir 4.0.2 → 4.0.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 +5 -5
- package/dist/MindElixir.js +447 -438
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +239 -224
- package/package.json +15 -13
- package/readme.md +2 -3
package/dist/MindElixirLite.js
CHANGED
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
document.write(
|
|
8
8
|
"<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>"
|
|
9
9
|
);
|
|
10
|
-
} catch
|
|
11
|
-
console && console.log(h);
|
|
10
|
+
} catch {
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
13
|
function d() {
|
|
@@ -30,7 +29,7 @@
|
|
|
30
29
|
s.readyState == "complete" && (s.onreadystatechange = null, d());
|
|
31
30
|
});
|
|
32
31
|
})(window);
|
|
33
|
-
const q = 0, Z = 1, ee = 2,
|
|
32
|
+
const q = 0, Z = 1, ee = 2, $ = 30, ge = {
|
|
34
33
|
name: "Latte",
|
|
35
34
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
36
35
|
cssVar: {
|
|
@@ -90,7 +89,7 @@ function ye(e, t, n, o) {
|
|
|
90
89
|
function ne() {
|
|
91
90
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16);
|
|
92
91
|
}
|
|
93
|
-
const
|
|
92
|
+
const Ae = function() {
|
|
94
93
|
const e = ne();
|
|
95
94
|
return {
|
|
96
95
|
topic: this.newTopicName,
|
|
@@ -119,7 +118,7 @@ const Ne = function() {
|
|
|
119
118
|
this.moved = !1, this.mousedown = !1;
|
|
120
119
|
}
|
|
121
120
|
};
|
|
122
|
-
function
|
|
121
|
+
function Ne(e) {
|
|
123
122
|
e.map.addEventListener("click", (t) => {
|
|
124
123
|
var o, s;
|
|
125
124
|
if (t.button !== 0)
|
|
@@ -169,7 +168,6 @@ const ke = {
|
|
|
169
168
|
return {
|
|
170
169
|
handlers: {},
|
|
171
170
|
showHandler: function() {
|
|
172
|
-
console.log(this.handlers);
|
|
173
171
|
},
|
|
174
172
|
addListener: function(e, t) {
|
|
175
173
|
this.handlers[e] === void 0 && (this.handlers[e] = []), this.handlers[e].push(t);
|
|
@@ -194,7 +192,7 @@ const ke = {
|
|
|
194
192
|
};
|
|
195
193
|
}
|
|
196
194
|
}, U = document, De = function() {
|
|
197
|
-
|
|
195
|
+
this.nodes.innerHTML = "";
|
|
198
196
|
const e = this.createTopic(this.nodeData);
|
|
199
197
|
be(e, this.nodeData), e.draggable = !1;
|
|
200
198
|
const t = U.createElement("me-root");
|
|
@@ -206,7 +204,7 @@ const ke = {
|
|
|
206
204
|
i.direction === q ? o += 1 : i.direction === Z ? s += 1 : o <= s ? (i.direction = q, o += 1) : (i.direction = Z, s += 1);
|
|
207
205
|
});
|
|
208
206
|
}
|
|
209
|
-
He(this, n, t)
|
|
207
|
+
He(this, n, t);
|
|
210
208
|
}, He = function(e, t, n) {
|
|
211
209
|
const o = U.createElement("me-main");
|
|
212
210
|
o.className = "lhs";
|
|
@@ -224,8 +222,8 @@ const ke = {
|
|
|
224
222
|
n.appendChild(i);
|
|
225
223
|
}
|
|
226
224
|
return n;
|
|
227
|
-
},
|
|
228
|
-
const o = (t ? t.mindElixirBox :
|
|
225
|
+
}, C = document, L = (e, t) => {
|
|
226
|
+
const o = (t ? t.mindElixirBox : C).querySelector(`[data-nodeid=me${e}]`);
|
|
229
227
|
if (!o)
|
|
230
228
|
throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
231
229
|
return o;
|
|
@@ -237,33 +235,32 @@ const ke = {
|
|
|
237
235
|
if (t.image) {
|
|
238
236
|
const n = t.image;
|
|
239
237
|
if (n.url && n.width && n.height) {
|
|
240
|
-
const o =
|
|
238
|
+
const o = C.createElement("img");
|
|
241
239
|
o.src = n.url, o.style.width = n.width + "px", o.style.height = n.height + "px", e.appendChild(o), e.image = o;
|
|
242
|
-
}
|
|
243
|
-
console.warn("image url/width/height are required");
|
|
240
|
+
}
|
|
244
241
|
} else
|
|
245
242
|
e.image && (e.image = void 0);
|
|
246
243
|
{
|
|
247
|
-
const n =
|
|
244
|
+
const n = C.createElement("span");
|
|
248
245
|
n.className = "text", n.textContent = t.topic, e.appendChild(n), e.text = n;
|
|
249
246
|
}
|
|
250
247
|
if (t.hyperLink) {
|
|
251
|
-
const n =
|
|
248
|
+
const n = C.createElement("a");
|
|
252
249
|
n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = t.hyperLink, e.appendChild(n), e.linkContainer = n;
|
|
253
250
|
} else
|
|
254
251
|
e.linkContainer && (e.linkContainer = void 0);
|
|
255
252
|
if (t.icons && t.icons.length) {
|
|
256
|
-
const n =
|
|
253
|
+
const n = C.createElement("span");
|
|
257
254
|
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${ie(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
|
|
258
255
|
} else
|
|
259
256
|
e.icons && (e.icons = void 0);
|
|
260
257
|
if (t.tags && t.tags.length) {
|
|
261
|
-
const n =
|
|
258
|
+
const n = C.createElement("div");
|
|
262
259
|
n.className = "tags", n.innerHTML = t.tags.map((o) => `<span>${ie(o)}</span>`).join(""), e.appendChild(n), e.tags = n;
|
|
263
260
|
} else
|
|
264
261
|
e.tags && (e.tags = void 0);
|
|
265
262
|
}, Pe = function(e, t) {
|
|
266
|
-
const n =
|
|
263
|
+
const n = C.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
|
|
267
264
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
268
265
|
const i = Re(e.expanded);
|
|
269
266
|
if (o.appendChild(i), e.expanded !== !1) {
|
|
@@ -273,25 +270,25 @@ const ke = {
|
|
|
273
270
|
}
|
|
274
271
|
return { grp: n, top: o, tpc: s };
|
|
275
272
|
}, ze = function(e) {
|
|
276
|
-
const t =
|
|
273
|
+
const t = C.createElement("me-parent"), n = this.createTopic(e);
|
|
277
274
|
return be(n, e), t.appendChild(n), { p: t, tpc: n };
|
|
278
275
|
}, je = function(e) {
|
|
279
|
-
const t =
|
|
276
|
+
const t = C.createElement("me-children");
|
|
280
277
|
return t.append(...e), t;
|
|
281
278
|
}, Oe = function(e) {
|
|
282
|
-
const t =
|
|
279
|
+
const t = C.createElement("me-tpc");
|
|
283
280
|
return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t.draggable = this.draggable, t;
|
|
284
281
|
};
|
|
285
282
|
function xe(e) {
|
|
286
|
-
const t =
|
|
283
|
+
const t = C.createRange();
|
|
287
284
|
t.selectNodeContents(e);
|
|
288
285
|
const n = window.getSelection();
|
|
289
286
|
n && (n.removeAllRanges(), n.addRange(t));
|
|
290
287
|
}
|
|
291
288
|
const qe = function(e) {
|
|
292
|
-
if (
|
|
289
|
+
if (!e)
|
|
293
290
|
return;
|
|
294
|
-
const t =
|
|
291
|
+
const t = C.createElement("div"), n = e.text.textContent;
|
|
295
292
|
e.appendChild(t), t.id = "input-box", t.textContent = n, t.contentEditable = "true", t.spellcheck = !1, t.style.cssText = `min-width:${e.offsetWidth - 8}px;`, this.direction === q && (t.style.right = "0"), t.focus(), xe(t), this.bus.fire("operation", {
|
|
296
293
|
name: "beginEdit",
|
|
297
294
|
obj: e.nodeObj
|
|
@@ -308,14 +305,14 @@ const qe = function(e) {
|
|
|
308
305
|
if (!t)
|
|
309
306
|
return;
|
|
310
307
|
const o = e.nodeObj, s = ((i = t.textContent) == null ? void 0 : i.trim()) || "";
|
|
311
|
-
|
|
308
|
+
s === "" ? o.topic = n : o.topic = s, t.remove(), s !== n && (e.text.textContent = o.topic, this.linkDiv(), this.bus.fire("operation", {
|
|
312
309
|
name: "finishEdit",
|
|
313
310
|
obj: o,
|
|
314
311
|
origin: n
|
|
315
312
|
}));
|
|
316
|
-
})
|
|
313
|
+
});
|
|
317
314
|
}, Re = function(e) {
|
|
318
|
-
const t =
|
|
315
|
+
const t = C.createElement("me-epd");
|
|
319
316
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
320
317
|
}, j = document, O = "http://www.w3.org/2000/svg", we = function(e, t, n) {
|
|
321
318
|
const o = j.createElementNS(O, "path");
|
|
@@ -347,7 +344,7 @@ const qe = function(e) {
|
|
|
347
344
|
"stroke-dasharray": "8,2"
|
|
348
345
|
}), o.appendChild(s), o.appendChild(i), o;
|
|
349
346
|
}, _e = function(e, t, n) {
|
|
350
|
-
if (
|
|
347
|
+
if (!t)
|
|
351
348
|
return;
|
|
352
349
|
const o = document.createElement("div");
|
|
353
350
|
e.nodes.appendChild(o);
|
|
@@ -366,9 +363,9 @@ const qe = function(e) {
|
|
|
366
363
|
}
|
|
367
364
|
}), o.addEventListener("blur", () => {
|
|
368
365
|
o && n(o);
|
|
369
|
-
})
|
|
366
|
+
});
|
|
370
367
|
}, Ie = function(e) {
|
|
371
|
-
|
|
368
|
+
this.nodes.style.top = `${1e4 - this.nodes.offsetHeight / 2}px`, this.nodes.style.left = `${1e4 - this.nodes.offsetWidth / 2}px`;
|
|
372
369
|
const t = this.map.querySelectorAll("me-main > me-wrapper");
|
|
373
370
|
this.lines.innerHTML = "";
|
|
374
371
|
const n = this.map.querySelector("me-root"), o = n.offsetTop, s = n.offsetLeft, i = n.offsetWidth, r = n.offsetHeight;
|
|
@@ -381,7 +378,7 @@ const qe = function(e) {
|
|
|
381
378
|
E.tagName === "svg" && E.remove(), c.appendChild(w), Ee(this, w, y, c, m, !0);
|
|
382
379
|
}
|
|
383
380
|
}
|
|
384
|
-
this.renderArrow(), this.renderSummary()
|
|
381
|
+
this.renderArrow(), this.renderSummary();
|
|
385
382
|
}, Ee = function(e, t, n, o, s, i) {
|
|
386
383
|
const r = o.firstChild, l = o.children[1].children, c = r.offsetTop, d = r.offsetLeft, h = r.offsetWidth, u = r.offsetHeight;
|
|
387
384
|
for (let a = 0; a < l.length; a++) {
|
|
@@ -424,11 +421,11 @@ function We(e) {
|
|
|
424
421
|
e.initSide();
|
|
425
422
|
}, t;
|
|
426
423
|
}
|
|
427
|
-
function
|
|
424
|
+
function Xe(e) {
|
|
428
425
|
e.container.append(Fe(e)), e.container.append(We(e));
|
|
429
426
|
}
|
|
430
|
-
/*! @viselect/vanilla v3.
|
|
431
|
-
var
|
|
427
|
+
/*! @viselect/vanilla v3.5.1 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */
|
|
428
|
+
var Ye = Object.defineProperty, Ge = (e, t, n) => t in e ? Ye(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, b = (e, t, n) => (Ge(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
432
429
|
class Ke {
|
|
433
430
|
constructor() {
|
|
434
431
|
b(this, "_listeners", /* @__PURE__ */ new Map()), b(this, "on", this.addEventListener), b(this, "off", this.removeEventListener), b(this, "emit", this.dispatchEvent);
|
|
@@ -452,23 +449,21 @@ class Ke {
|
|
|
452
449
|
}
|
|
453
450
|
}
|
|
454
451
|
const ce = (e, t = "px") => typeof e == "number" ? e + t : e;
|
|
455
|
-
function
|
|
452
|
+
function M({ style: e }, t, n) {
|
|
456
453
|
if (typeof t == "object")
|
|
457
454
|
for (const [o, s] of Object.entries(t))
|
|
458
455
|
s !== void 0 && (e[o] = ce(s));
|
|
459
456
|
else
|
|
460
457
|
n !== void 0 && (e[t] = ce(n));
|
|
461
458
|
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
459
|
+
const Ce = (e) => (t, n, o, s = {}) => {
|
|
460
|
+
t instanceof HTMLCollection || t instanceof NodeList ? t = Array.from(t) : Array.isArray(t) || (t = [t]), Array.isArray(n) || (n = [n]);
|
|
461
|
+
for (const i of t)
|
|
462
|
+
if (i)
|
|
466
463
|
for (const r of n)
|
|
467
464
|
i[e](r, o, { capture: !1, ...s });
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
}
|
|
471
|
-
const B = Se("addEventListener"), $ = Se("removeEventListener"), Y = (e) => {
|
|
465
|
+
return [t, n, o, s];
|
|
466
|
+
}, B = Ce("addEventListener"), T = Ce("removeEventListener"), X = (e) => {
|
|
472
467
|
var t;
|
|
473
468
|
const { clientX: n, clientY: o, target: s } = ((t = e.touches) == null ? void 0 : t[0]) ?? e;
|
|
474
469
|
return { x: n, y: o, target: s };
|
|
@@ -506,8 +501,29 @@ const Ue = () => matchMedia("(hover: none), (pointer: coarse)").matches, Je = ()
|
|
|
506
501
|
cancelAnimationFrame(n), o = !1;
|
|
507
502
|
}
|
|
508
503
|
};
|
|
509
|
-
}
|
|
510
|
-
|
|
504
|
+
};
|
|
505
|
+
function Ze(e, t) {
|
|
506
|
+
for (const n of t) {
|
|
507
|
+
if (typeof n == "number")
|
|
508
|
+
return e.button === n;
|
|
509
|
+
if (typeof n == "object") {
|
|
510
|
+
const o = n.button === e.button, s = n.modifiers.every((i) => {
|
|
511
|
+
switch (i) {
|
|
512
|
+
case "alt":
|
|
513
|
+
return e.altKey;
|
|
514
|
+
case "ctrl":
|
|
515
|
+
return e.ctrlKey || e.metaKey;
|
|
516
|
+
case "shift":
|
|
517
|
+
return e.shiftKey;
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
return o && s;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
return !1;
|
|
524
|
+
}
|
|
525
|
+
const { abs: D, max: he, min: de, ceil: ue } = Math;
|
|
526
|
+
class et extends Ke {
|
|
511
527
|
constructor(t) {
|
|
512
528
|
var n, o, s, i, r;
|
|
513
529
|
super(), b(this, "_options"), b(this, "_selection", {
|
|
@@ -532,6 +548,7 @@ class Ze extends Ke {
|
|
|
532
548
|
behaviour: {
|
|
533
549
|
overlap: "invert",
|
|
534
550
|
intersect: "touch",
|
|
551
|
+
triggers: [0],
|
|
535
552
|
...t.behaviour,
|
|
536
553
|
startThreshold: (n = t.behaviour) != null && n.startThreshold ? typeof t.behaviour.startThreshold == "number" ? t.behaviour.startThreshold : { x: 10, y: 10, ...t.behaviour.startThreshold } : { x: 10, y: 10 },
|
|
537
554
|
scrolling: {
|
|
@@ -559,12 +576,12 @@ class Ze extends Ke {
|
|
|
559
576
|
for (const h of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
|
560
577
|
typeof this[h] == "function" && (this[h] = this[h].bind(this));
|
|
561
578
|
const { document: l, selectionAreaClass: c, selectionContainerClass: d } = this._options;
|
|
562
|
-
this._area = l.createElement("div"), this._clippingElement = l.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(c), d && this._clippingElement.classList.add(d),
|
|
579
|
+
this._area = l.createElement("div"), this._clippingElement = l.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(c), d && this._clippingElement.classList.add(d), M(this._area, {
|
|
563
580
|
willChange: "top, left, bottom, right, width, height",
|
|
564
581
|
top: 0,
|
|
565
582
|
left: 0,
|
|
566
583
|
position: "fixed"
|
|
567
|
-
}),
|
|
584
|
+
}), M(this._clippingElement, {
|
|
568
585
|
overflow: "hidden",
|
|
569
586
|
position: "fixed",
|
|
570
587
|
transform: "translate3d(0, 0, 0)",
|
|
@@ -576,13 +593,16 @@ class Ze extends Ke {
|
|
|
576
593
|
}), this.enable();
|
|
577
594
|
}
|
|
578
595
|
_bindStartEvents(t = !0) {
|
|
579
|
-
const { document: n, features: o } = this._options, s = t ? B :
|
|
596
|
+
const { document: n, features: o } = this._options, s = t ? B : T;
|
|
580
597
|
s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, {
|
|
581
598
|
passive: !1
|
|
582
599
|
});
|
|
583
600
|
}
|
|
584
601
|
_onTapStart(t, n = !1) {
|
|
585
|
-
const { x: o, y: s, target: i } =
|
|
602
|
+
const { x: o, y: s, target: i } = X(t), { _options: r } = this, { document: l } = this._options, c = i.getBoundingClientRect();
|
|
603
|
+
if (t instanceof MouseEvent && !Ze(t, r.behaviour.triggers))
|
|
604
|
+
return;
|
|
605
|
+
const d = P(r.startAreas, r.document), h = P(r.boundaries, r.document);
|
|
586
606
|
this._targetElement = h.find(
|
|
587
607
|
(p) => ae(p.getBoundingClientRect(), c)
|
|
588
608
|
);
|
|
@@ -594,7 +614,7 @@ class Ze extends Ke {
|
|
|
594
614
|
this._scrollDelta = { x: a.scrollLeft, y: a.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), B(l, ["touchmove", "mousemove"], this._delayedTapMove, { passive: !1 }), B(l, ["mouseup", "touchcancel", "touchend"], this._onTapStop), B(l, "scroll", this._onScroll);
|
|
595
615
|
}
|
|
596
616
|
_onSingleTap(t) {
|
|
597
|
-
const { singleTap: { intersect: n }, range: o } = this._options.features, s =
|
|
617
|
+
const { singleTap: { intersect: n }, range: o } = this._options.features, s = X(t);
|
|
598
618
|
let i;
|
|
599
619
|
if (n === "native")
|
|
600
620
|
i = s.target;
|
|
@@ -621,45 +641,44 @@ class Ze extends Ke {
|
|
|
621
641
|
this.select(h), this._latestElement = l;
|
|
622
642
|
} else
|
|
623
643
|
r.includes(i) && (r.length === 1 || t.ctrlKey || r.every((l) => this._selection.stored.includes(l))) ? this.deselect(i) : (this.select(i), this._latestElement = i);
|
|
624
|
-
this._emitEvent("stop", t);
|
|
625
644
|
}
|
|
626
645
|
_delayedTapMove(t) {
|
|
627
|
-
const { container: n, document: o, behaviour: { startThreshold: s } } = this._options, { x1: i, y1: r } = this._areaLocation, { x: l, y: c } =
|
|
646
|
+
const { container: n, document: o, behaviour: { startThreshold: s } } = this._options, { x1: i, y1: r } = this._areaLocation, { x: l, y: c } = X(t);
|
|
628
647
|
if (
|
|
629
648
|
// Single number for both coordinates
|
|
630
649
|
typeof s == "number" && D(l + c - (i + r)) >= s || // Different x and y threshold
|
|
631
650
|
typeof s == "object" && D(l - i) >= s.x || D(c - r) >= s.y
|
|
632
651
|
) {
|
|
633
|
-
if (
|
|
634
|
-
|
|
652
|
+
if (T(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
653
|
+
T(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
|
|
635
654
|
return;
|
|
636
655
|
}
|
|
637
|
-
B(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }),
|
|
656
|
+
B(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), M(this._area, "display", "block"), P(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 && (B(this._targetElement, "wheel", this._manualScroll, { passive: !1 }), this._selectables = this._selectables.filter((d) => this._targetElement.contains(d))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
|
|
638
657
|
}
|
|
639
658
|
this._handleMoveEvent(t);
|
|
640
659
|
}
|
|
641
660
|
_setupSelectionArea() {
|
|
642
661
|
const { _clippingElement: t, _targetElement: n, _area: o } = this, s = this._targetRect = n.getBoundingClientRect();
|
|
643
|
-
this._scrollAvailable ? (
|
|
662
|
+
this._scrollAvailable ? (M(t, {
|
|
644
663
|
top: s.top,
|
|
645
664
|
left: s.left,
|
|
646
665
|
width: s.width,
|
|
647
666
|
height: s.height
|
|
648
|
-
}),
|
|
667
|
+
}), M(o, {
|
|
649
668
|
marginTop: -s.top,
|
|
650
669
|
marginLeft: -s.left
|
|
651
|
-
})) : (
|
|
670
|
+
})) : (M(t, {
|
|
652
671
|
top: 0,
|
|
653
672
|
left: 0,
|
|
654
673
|
width: "100%",
|
|
655
674
|
height: "100%"
|
|
656
|
-
}),
|
|
675
|
+
}), M(o, {
|
|
657
676
|
marginTop: 0,
|
|
658
677
|
marginLeft: 0
|
|
659
678
|
}));
|
|
660
679
|
}
|
|
661
680
|
_onTapMove(t) {
|
|
662
|
-
const { x: n, y: o } =
|
|
681
|
+
const { x: n, y: o } = X(t), { _scrollSpeed: s, _areaLocation: i, _options: r, _frame: l } = this, { speedDivider: c } = r.behaviour.scrolling, d = this._targetElement;
|
|
663
682
|
if (i.x2 = n, i.y2 = o, this._scrollAvailable && !this._scrollingActive && (s.y || s.x)) {
|
|
664
683
|
this._scrollingActive = !0;
|
|
665
684
|
const h = () => {
|
|
@@ -702,7 +721,7 @@ class Ze extends Ke {
|
|
|
702
721
|
_onTapStop(t, n) {
|
|
703
722
|
var o;
|
|
704
723
|
const { document: s, features: i } = this._options, { _singleClick: r } = this;
|
|
705
|
-
|
|
724
|
+
T(s, ["mousemove", "touchmove"], this._delayedTapMove), T(s, ["touchmove", "mousemove"], this._onTapMove), T(s, ["mouseup", "touchcancel", "touchend"], this._onTapStop), T(s, "scroll", this._onScroll), this._keepSelection(), t && r && i.singleTap.allow ? this._onSingleTap(t) : !r && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, T(this._targetElement, "wheel", this._manualScroll, { passive: !0 }), this._clippingElement.remove(), (o = this._frame) == null || o.cancel(), M(this._area, "display", "none");
|
|
706
725
|
}
|
|
707
726
|
_updateElementSelection() {
|
|
708
727
|
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: r, touched: l } = o, { intersect: c, overlap: d } = n.behaviour, h = d === "invert", u = [], a = [], p = [];
|
|
@@ -847,8 +866,8 @@ class Ze extends Ke {
|
|
|
847
866
|
), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)));
|
|
848
867
|
}
|
|
849
868
|
}
|
|
850
|
-
b(
|
|
851
|
-
const
|
|
869
|
+
b(et, "version", "3.5.1");
|
|
870
|
+
const tt = function(e, t = !0) {
|
|
852
871
|
this.theme = e;
|
|
853
872
|
const n = this.theme.cssVar, o = Object.keys(n);
|
|
854
873
|
for (let s = 0; s < o.length; s++) {
|
|
@@ -857,7 +876,7 @@ const et = function(e, t = !0) {
|
|
|
857
876
|
}
|
|
858
877
|
t && this.refresh();
|
|
859
878
|
};
|
|
860
|
-
function
|
|
879
|
+
function Se(e) {
|
|
861
880
|
return {
|
|
862
881
|
nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
|
|
863
882
|
arrows: e.arrows,
|
|
@@ -866,41 +885,41 @@ function Ce(e) {
|
|
|
866
885
|
theme: e.theme
|
|
867
886
|
};
|
|
868
887
|
}
|
|
869
|
-
const
|
|
888
|
+
const nt = function(e, t, n) {
|
|
870
889
|
if (e) {
|
|
871
|
-
if (
|
|
890
|
+
if (this.clearSelection(), typeof e == "string") {
|
|
872
891
|
const o = L(e);
|
|
873
892
|
return o ? this.selectNode(o) : void 0;
|
|
874
893
|
}
|
|
875
|
-
e.className = "selected", e.scrollIntoView({ block: "nearest", inline: "nearest" }), this.currentNode = e, t ? this.bus.fire("selectNewNode", e.nodeObj) : this.bus.fire("selectNode", e.nodeObj, n)
|
|
894
|
+
e.className = "selected", e.scrollIntoView({ block: "nearest", inline: "nearest" }), this.currentNode = e, t ? this.bus.fire("selectNewNode", e.nodeObj) : this.bus.fire("selectNode", e.nodeObj, n);
|
|
876
895
|
}
|
|
877
|
-
},
|
|
896
|
+
}, ot = function() {
|
|
878
897
|
this.currentNode && (this.currentNode.className = ""), this.currentNode = null, this.bus.fire("unselectNode");
|
|
879
|
-
},
|
|
880
|
-
|
|
898
|
+
}, st = function(e) {
|
|
899
|
+
this.clearSelection();
|
|
881
900
|
for (const t of e)
|
|
882
901
|
t.className = "selected";
|
|
883
902
|
this.currentNodes = e, this.bus.fire(
|
|
884
903
|
"selectNodes",
|
|
885
904
|
e.map((t) => t.nodeObj)
|
|
886
|
-
)
|
|
887
|
-
},
|
|
905
|
+
);
|
|
906
|
+
}, it = function() {
|
|
888
907
|
if (this.currentNodes)
|
|
889
908
|
for (const e of this.currentNodes)
|
|
890
909
|
e.classList.remove("selected");
|
|
891
910
|
this.currentNodes = null, this.bus.fire("unselectNodes");
|
|
892
|
-
}, it = function() {
|
|
893
|
-
this.unselectNode(), this.unselectNodes(), this.unselectSummary(), this.unselectArrow();
|
|
894
911
|
}, rt = function() {
|
|
895
|
-
|
|
912
|
+
this.unselectNode(), this.unselectNodes(), this.unselectSummary(), this.unselectArrow();
|
|
913
|
+
}, lt = function() {
|
|
914
|
+
const e = Se(this);
|
|
896
915
|
return JSON.stringify(e, (t, n) => {
|
|
897
916
|
if (!(t === "parent" && typeof n != "string"))
|
|
898
917
|
return n;
|
|
899
918
|
});
|
|
900
|
-
}, lt = function() {
|
|
901
|
-
return JSON.parse(this.getDataString());
|
|
902
919
|
}, ct = function() {
|
|
903
|
-
|
|
920
|
+
return JSON.parse(this.getDataString());
|
|
921
|
+
}, at = function() {
|
|
922
|
+
const e = Se(this).nodeData;
|
|
904
923
|
let t = "# " + e.topic + `
|
|
905
924
|
|
|
906
925
|
`;
|
|
@@ -912,57 +931,57 @@ const tt = function(e, t, n) {
|
|
|
912
931
|
`, o[i].children && n(o[i].children || [], s + 1);
|
|
913
932
|
}
|
|
914
933
|
return n(e.children || [], 2), t;
|
|
915
|
-
}, at = function() {
|
|
916
|
-
this.editable = !0;
|
|
917
934
|
}, ht = function() {
|
|
935
|
+
this.editable = !0;
|
|
936
|
+
}, dt = function() {
|
|
918
937
|
this.editable = !1;
|
|
919
|
-
},
|
|
938
|
+
}, ut = function(e) {
|
|
920
939
|
this.scaleVal = e, this.map.style.transform = "scale(" + e + ")";
|
|
921
|
-
},
|
|
940
|
+
}, ft = function() {
|
|
922
941
|
this.container.scrollTo(1e4 - this.container.offsetWidth / 2, 1e4 - this.container.offsetHeight / 2);
|
|
923
|
-
}, ft = function(e) {
|
|
924
|
-
e(this);
|
|
925
942
|
}, pt = function(e) {
|
|
943
|
+
e(this);
|
|
944
|
+
}, mt = function(e) {
|
|
926
945
|
e.nodeObj.root || (this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = e.nodeObj, this.nodeData.root = !0, this.initRight(), this.toCenter());
|
|
927
|
-
}, mt = function() {
|
|
928
|
-
this.isFocusMode = !1, this.tempDirection !== null && (delete this.nodeData.root, this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
929
946
|
}, gt = function() {
|
|
930
|
-
this.direction =
|
|
947
|
+
this.isFocusMode = !1, this.tempDirection !== null && (delete this.nodeData.root, this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
931
948
|
}, vt = function() {
|
|
932
|
-
this.direction =
|
|
949
|
+
this.direction = 0, this.refresh();
|
|
933
950
|
}, yt = function() {
|
|
951
|
+
this.direction = 1, this.refresh();
|
|
952
|
+
}, bt = function() {
|
|
934
953
|
this.direction = 2, this.refresh();
|
|
935
|
-
},
|
|
954
|
+
}, xt = function(e) {
|
|
936
955
|
this.locale = e, this.refresh();
|
|
937
|
-
},
|
|
956
|
+
}, wt = function(e, t) {
|
|
938
957
|
const n = e.nodeObj;
|
|
939
958
|
typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0, this.layout(), this.linkDiv(), this.bus.fire("expandNode", n);
|
|
940
|
-
},
|
|
959
|
+
}, _t = function(e) {
|
|
941
960
|
e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || []), te(this.nodeData), this.layout(), this.linkDiv();
|
|
942
|
-
},
|
|
961
|
+
}, Et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
943
962
|
__proto__: null,
|
|
944
|
-
cancelFocus:
|
|
945
|
-
clearSelection:
|
|
946
|
-
disableEdit:
|
|
947
|
-
enableEdit:
|
|
948
|
-
expandNode:
|
|
949
|
-
focusNode:
|
|
950
|
-
getData:
|
|
951
|
-
getDataMd:
|
|
952
|
-
getDataString:
|
|
953
|
-
initLeft:
|
|
954
|
-
initRight:
|
|
955
|
-
initSide:
|
|
956
|
-
install:
|
|
957
|
-
refresh:
|
|
958
|
-
scale:
|
|
959
|
-
selectNode:
|
|
960
|
-
selectNodes:
|
|
961
|
-
setLocale:
|
|
962
|
-
toCenter:
|
|
963
|
-
unselectNode:
|
|
964
|
-
unselectNodes:
|
|
965
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
963
|
+
cancelFocus: gt,
|
|
964
|
+
clearSelection: rt,
|
|
965
|
+
disableEdit: dt,
|
|
966
|
+
enableEdit: ht,
|
|
967
|
+
expandNode: wt,
|
|
968
|
+
focusNode: mt,
|
|
969
|
+
getData: ct,
|
|
970
|
+
getDataMd: at,
|
|
971
|
+
getDataString: lt,
|
|
972
|
+
initLeft: vt,
|
|
973
|
+
initRight: yt,
|
|
974
|
+
initSide: bt,
|
|
975
|
+
install: pt,
|
|
976
|
+
refresh: _t,
|
|
977
|
+
scale: ut,
|
|
978
|
+
selectNode: nt,
|
|
979
|
+
selectNodes: st,
|
|
980
|
+
setLocale: xt,
|
|
981
|
+
toCenter: ft,
|
|
982
|
+
unselectNode: ot,
|
|
983
|
+
unselectNodes: it
|
|
984
|
+
}, Symbol.toStringTag, { value: "Module" })), Ct = function(e) {
|
|
966
985
|
return {
|
|
967
986
|
dom: e,
|
|
968
987
|
moved: !1,
|
|
@@ -989,7 +1008,7 @@ const tt = function(e, t, n) {
|
|
|
989
1008
|
}
|
|
990
1009
|
};
|
|
991
1010
|
}, fe = {
|
|
992
|
-
create:
|
|
1011
|
+
create: Ct
|
|
993
1012
|
};
|
|
994
1013
|
function J(e, t, n) {
|
|
995
1014
|
const { offsetLeft: o, offsetTop: s } = A(e.nodes, t), i = t.offsetWidth, r = t.offsetHeight, l = o + i / 2, c = s + r / 2, d = l + n.x, h = c + n.y;
|
|
@@ -1021,14 +1040,13 @@ const St = function(e, t, n, o) {
|
|
|
1021
1040
|
}, Le = function(e, t, n, o, s) {
|
|
1022
1041
|
if (!t || !n)
|
|
1023
1042
|
return;
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
`M ${
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
}, Ct = function(e, t) {
|
|
1043
|
+
performance.now();
|
|
1044
|
+
const i = J(e, t, o.delta1), r = J(e, n, o.delta2), { x: l, y: c } = z(i), { ctrlX: d, ctrlY: h } = i, { ctrlX: u, ctrlY: a } = r, { x: p, y: m } = z(r), f = ye(u, a, p, m), g = Ve(
|
|
1045
|
+
`M ${l} ${c} C ${d} ${h} ${u} ${a} ${p} ${m}`,
|
|
1046
|
+
`M ${f.x1} ${f.y1} L ${p} ${m} L ${f.x2} ${f.y2}`
|
|
1047
|
+
), y = l / 8 + d * 3 / 8 + u * 3 / 8 + p / 8, v = c / 8 + h * 3 / 8 + a * 3 / 8 + m / 8, w = St(o.label, y, v, e.theme.cssVar["--color"]);
|
|
1048
|
+
g.appendChild(w), g.arrowObj = o, g.dataset.linkid = o.id, e.linkSvgGroup.appendChild(g), s || (e.arrows.push(o), e.currentArrow = g, Te(e, o, i, r)), performance.now();
|
|
1049
|
+
}, Lt = function(e, t) {
|
|
1032
1050
|
const n = {
|
|
1033
1051
|
id: ne(),
|
|
1034
1052
|
label: "Custom Link",
|
|
@@ -1047,7 +1065,7 @@ const St = function(e, t, n, o) {
|
|
|
1047
1065
|
name: "createArrow",
|
|
1048
1066
|
obj: n
|
|
1049
1067
|
});
|
|
1050
|
-
},
|
|
1068
|
+
}, Mt = function(e) {
|
|
1051
1069
|
let t;
|
|
1052
1070
|
if (e ? t = e : t = this.currentArrow, !t)
|
|
1053
1071
|
return;
|
|
@@ -1059,11 +1077,11 @@ const St = function(e, t, n, o) {
|
|
|
1059
1077
|
id: n
|
|
1060
1078
|
}
|
|
1061
1079
|
});
|
|
1062
|
-
},
|
|
1080
|
+
}, Tt = function(e) {
|
|
1063
1081
|
this.currentArrow = e;
|
|
1064
1082
|
const t = e.arrowObj, n = L(t.from), o = L(t.to), s = J(this, n, t.delta1), i = J(this, o, t.delta2);
|
|
1065
1083
|
Te(this, t, s, i);
|
|
1066
|
-
},
|
|
1084
|
+
}, $t = function() {
|
|
1067
1085
|
this.currentArrow = null, Me(this);
|
|
1068
1086
|
}, Me = function(e) {
|
|
1069
1087
|
e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none";
|
|
@@ -1113,44 +1131,43 @@ const St = function(e, t, n, o) {
|
|
|
1113
1131
|
}), t.delta2.x = c - o.cx, t.delta2.y = d - o.cy;
|
|
1114
1132
|
});
|
|
1115
1133
|
};
|
|
1116
|
-
function
|
|
1134
|
+
function At() {
|
|
1117
1135
|
this.linkSvgGroup.innerHTML = "";
|
|
1118
1136
|
for (let e = 0; e < this.arrows.length; e++) {
|
|
1119
1137
|
const t = this.arrows[e];
|
|
1120
1138
|
try {
|
|
1121
1139
|
Le(this, L(t.from), L(t.to), t, !0);
|
|
1122
1140
|
} catch {
|
|
1123
|
-
console.warn("Node may not be expanded");
|
|
1124
1141
|
}
|
|
1125
1142
|
}
|
|
1126
1143
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
1127
1144
|
}
|
|
1128
1145
|
function Nt(e) {
|
|
1129
|
-
if (
|
|
1146
|
+
if (!e)
|
|
1130
1147
|
return;
|
|
1131
1148
|
const t = e.children[2];
|
|
1132
|
-
|
|
1149
|
+
_e(this, t, (n) => {
|
|
1133
1150
|
var i;
|
|
1134
1151
|
const o = e.arrowObj, s = ((i = n.textContent) == null ? void 0 : i.trim()) || "";
|
|
1135
1152
|
s === "" ? o.label = origin : o.label = s, n.remove(), s !== origin && (t.innerHTML = o.label, this.linkDiv(), this.bus.fire("operation", {
|
|
1136
1153
|
name: "finishEditArrowLabel",
|
|
1137
1154
|
obj: o
|
|
1138
1155
|
}));
|
|
1139
|
-
})
|
|
1156
|
+
});
|
|
1140
1157
|
}
|
|
1141
|
-
function
|
|
1158
|
+
function kt() {
|
|
1142
1159
|
this.arrows = this.arrows.filter((e) => K(e.from, this.nodeData) && K(e.to, this.nodeData));
|
|
1143
1160
|
}
|
|
1144
|
-
const
|
|
1161
|
+
const Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1145
1162
|
__proto__: null,
|
|
1146
|
-
createArrow:
|
|
1163
|
+
createArrow: Lt,
|
|
1147
1164
|
editArrowLabel: Nt,
|
|
1148
|
-
removeArrow:
|
|
1149
|
-
renderArrow:
|
|
1150
|
-
selectArrow:
|
|
1151
|
-
tidyArrow:
|
|
1152
|
-
unselectArrow:
|
|
1153
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1165
|
+
removeArrow: Mt,
|
|
1166
|
+
renderArrow: At,
|
|
1167
|
+
selectArrow: Tt,
|
|
1168
|
+
tidyArrow: kt,
|
|
1169
|
+
unselectArrow: $t
|
|
1170
|
+
}, Symbol.toStringTag, { value: "Module" })), Ht = function(e) {
|
|
1154
1171
|
var c, d;
|
|
1155
1172
|
if (e.length === 0)
|
|
1156
1173
|
throw new Error("No selected node.");
|
|
@@ -1193,7 +1210,7 @@ const kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1193
1210
|
start: i,
|
|
1194
1211
|
end: r
|
|
1195
1212
|
};
|
|
1196
|
-
},
|
|
1213
|
+
}, Bt = function(e) {
|
|
1197
1214
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1198
1215
|
return t.setAttribute("id", e), t;
|
|
1199
1216
|
}, pe = function(e, t) {
|
|
@@ -1213,43 +1230,43 @@ const kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1213
1230
|
y: n + "",
|
|
1214
1231
|
fill: s || "#666"
|
|
1215
1232
|
}), i.innerHTML = e, i;
|
|
1216
|
-
},
|
|
1233
|
+
}, Pt = (e) => L(e).parentElement.parentElement, zt = function({ parent: e, start: t }) {
|
|
1217
1234
|
var i, r;
|
|
1218
1235
|
const n = L(e), o = n.nodeObj;
|
|
1219
1236
|
let s;
|
|
1220
1237
|
return o.root === !0 ? s = (i = L(o.children[t].id).closest("me-main")) == null ? void 0 : i.className : s = (r = n.closest("me-main")) == null ? void 0 : r.className, s;
|
|
1221
1238
|
}, $e = function(e, t) {
|
|
1222
1239
|
var Q;
|
|
1223
|
-
const { id: n, text: o, parent: s, start: i, end: r } = t, l = e.nodes, d = L(s).nodeObj, h =
|
|
1240
|
+
const { id: n, text: o, parent: s, start: i, end: r } = t, l = e.nodes, d = L(s).nodeObj, h = zt(t);
|
|
1224
1241
|
let u = 1 / 0, a = 0, p = 0, m = 0;
|
|
1225
1242
|
for (let R = i; R <= r; R++) {
|
|
1226
1243
|
const oe = (Q = d.children) == null ? void 0 : Q[R];
|
|
1227
1244
|
if (!oe)
|
|
1228
|
-
return
|
|
1229
|
-
const F =
|
|
1245
|
+
return e.removeSummary(n), null;
|
|
1246
|
+
const F = Pt(oe.id), { offsetLeft: W, offsetTop: se } = A(l, F);
|
|
1230
1247
|
R === i && (p = se), R === r && (m = se + F.offsetHeight), W < u && (u = W), F.offsetWidth + W > a && (a = F.offsetWidth + W);
|
|
1231
1248
|
}
|
|
1232
1249
|
let f, g;
|
|
1233
1250
|
const y = p + 10, v = m + 10, w = (y + v) / 2, E = e.theme.cssVar["--color"];
|
|
1234
1251
|
h === "lhs" ? (f = pe(`M ${u + 10} ${y} c -5 0 -10 5 -10 10 L ${u} ${v - 10} c 0 5 5 10 10 10 M ${u} ${w} h -10`, E), g = me(o, u - 20, w + 6, "end", E)) : (f = pe(`M ${a - 10} ${y} c 5 0 10 5 10 10 L ${a} ${v - 10} c 0 5 -5 10 -10 10 M ${a} ${w} h 10`, E), g = me(o, a + 20, w + 6, "start", E));
|
|
1235
|
-
const _ =
|
|
1252
|
+
const _ = Bt("s-" + n);
|
|
1236
1253
|
return _.appendChild(f), _.appendChild(g), _.summaryObj = t, e.summarySvg.appendChild(_), _;
|
|
1237
|
-
},
|
|
1254
|
+
}, jt = function() {
|
|
1238
1255
|
let e = [];
|
|
1239
1256
|
this.currentNode ? e = [this.currentNode] : this.currentNodes && (e = this.currentNodes);
|
|
1240
|
-
const { parent: t, start: n, end: o } =
|
|
1257
|
+
const { parent: t, start: n, end: o } = Ht(e), s = { id: ne(), parent: t, start: n, end: o, text: "summary" }, i = $e(this, s);
|
|
1241
1258
|
this.summaries.push(s), this.editSummary(i), this.bus.fire("operation", {
|
|
1242
1259
|
name: "createSummary",
|
|
1243
1260
|
obj: s
|
|
1244
1261
|
});
|
|
1245
|
-
},
|
|
1262
|
+
}, Ot = function(e) {
|
|
1246
1263
|
var n;
|
|
1247
1264
|
const t = this.summaries.findIndex((o) => o.id === e);
|
|
1248
1265
|
t > -1 && (this.summaries.splice(t, 1), (n = document.querySelector("#s-" + e)) == null || n.remove()), this.bus.fire("operation", {
|
|
1249
1266
|
name: "removeSummary",
|
|
1250
1267
|
obj: { id: e }
|
|
1251
1268
|
});
|
|
1252
|
-
},
|
|
1269
|
+
}, qt = function(e) {
|
|
1253
1270
|
const t = e.children[1].getBBox(), n = 6, o = 3, s = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
1254
1271
|
x(s, {
|
|
1255
1272
|
x: t.x - n + "",
|
|
@@ -1261,19 +1278,18 @@ const kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1261
1278
|
"stroke-width": "2",
|
|
1262
1279
|
fill: "none"
|
|
1263
1280
|
}), s.classList.add("selected"), e.appendChild(s), this.currentSummary = e;
|
|
1264
|
-
},
|
|
1281
|
+
}, Rt = function() {
|
|
1265
1282
|
var e, t;
|
|
1266
1283
|
(t = (e = this.currentSummary) == null ? void 0 : e.querySelector("rect")) == null || t.remove(), this.currentSummary = null;
|
|
1267
|
-
},
|
|
1284
|
+
}, Vt = function() {
|
|
1268
1285
|
this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
|
|
1269
1286
|
try {
|
|
1270
1287
|
$e(this, e);
|
|
1271
1288
|
} catch {
|
|
1272
|
-
console.warn("Node may not be expanded");
|
|
1273
1289
|
}
|
|
1274
1290
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
1275
|
-
},
|
|
1276
|
-
if (
|
|
1291
|
+
}, It = function(e) {
|
|
1292
|
+
if (!e)
|
|
1277
1293
|
return;
|
|
1278
1294
|
const t = e.childNodes[1];
|
|
1279
1295
|
_e(this, t, (n) => {
|
|
@@ -1283,37 +1299,37 @@ const kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1283
1299
|
name: "finishEditSummary",
|
|
1284
1300
|
obj: o
|
|
1285
1301
|
}));
|
|
1286
|
-
})
|
|
1287
|
-
},
|
|
1302
|
+
});
|
|
1303
|
+
}, Ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1288
1304
|
__proto__: null,
|
|
1289
|
-
createSummary:
|
|
1290
|
-
editSummary:
|
|
1291
|
-
removeSummary:
|
|
1292
|
-
renderSummary:
|
|
1293
|
-
selectSummary:
|
|
1294
|
-
unselectSummary:
|
|
1295
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1296
|
-
function
|
|
1297
|
-
const n = document.createElementNS(
|
|
1305
|
+
createSummary: jt,
|
|
1306
|
+
editSummary: It,
|
|
1307
|
+
removeSummary: Ot,
|
|
1308
|
+
renderSummary: Vt,
|
|
1309
|
+
selectSummary: qt,
|
|
1310
|
+
unselectSummary: Rt
|
|
1311
|
+
}, Symbol.toStringTag, { value: "Module" })), S = "http://www.w3.org/2000/svg";
|
|
1312
|
+
function Wt(e, t) {
|
|
1313
|
+
const n = document.createElementNS(S, "svg");
|
|
1298
1314
|
return x(n, {
|
|
1299
1315
|
version: "1.1",
|
|
1300
|
-
xmlns:
|
|
1316
|
+
xmlns: S,
|
|
1301
1317
|
height: e,
|
|
1302
1318
|
width: t
|
|
1303
1319
|
}), n;
|
|
1304
1320
|
}
|
|
1305
|
-
function
|
|
1321
|
+
function Xt(e, t) {
|
|
1306
1322
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
1307
1323
|
}
|
|
1308
1324
|
function Yt(e, t, n, o) {
|
|
1309
|
-
const s = document.createElementNS(
|
|
1325
|
+
const s = document.createElementNS(S, "g");
|
|
1310
1326
|
let i = "";
|
|
1311
1327
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
1312
1328
|
`).forEach((l, c) => {
|
|
1313
|
-
const d = document.createElementNS(
|
|
1329
|
+
const d = document.createElementNS(S, "text");
|
|
1314
1330
|
x(d, {
|
|
1315
1331
|
x: n + parseInt(t.paddingLeft) + "",
|
|
1316
|
-
y: o + parseInt(t.paddingTop) +
|
|
1332
|
+
y: o + parseInt(t.paddingTop) + Xt(t.lineHeight, t.fontSize) * (c + 1) + parseFloat(t.fontSize) * (c + 1) + "",
|
|
1317
1333
|
"text-anchor": "start",
|
|
1318
1334
|
"font-family": t.fontFamily,
|
|
1319
1335
|
"font-size": `${t.fontSize}`,
|
|
@@ -1322,11 +1338,11 @@ function Yt(e, t, n, o) {
|
|
|
1322
1338
|
}), d.innerHTML = l, s.appendChild(d);
|
|
1323
1339
|
}), s;
|
|
1324
1340
|
}
|
|
1325
|
-
function
|
|
1341
|
+
function Gt(e, t, n, o) {
|
|
1326
1342
|
var l;
|
|
1327
1343
|
let s = "";
|
|
1328
1344
|
(l = e.nodeObj) != null && l.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
1329
|
-
const i = document.createElementNS(
|
|
1345
|
+
const i = document.createElementNS(S, "foreignObject");
|
|
1330
1346
|
x(i, {
|
|
1331
1347
|
x: n + parseInt(t.paddingLeft) + "",
|
|
1332
1348
|
y: o + parseInt(t.paddingTop) + "",
|
|
@@ -1339,8 +1355,8 @@ function Xt(e, t, n, o) {
|
|
|
1339
1355
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
1340
1356
|
}), r.innerHTML = s, i.appendChild(r), i;
|
|
1341
1357
|
}
|
|
1342
|
-
function
|
|
1343
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = A(e.nodes, t), i = document.createElementNS(
|
|
1358
|
+
function Kt(e, t) {
|
|
1359
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = A(e.nodes, t), i = document.createElementNS(S, "rect");
|
|
1344
1360
|
return x(i, {
|
|
1345
1361
|
x: o + "",
|
|
1346
1362
|
y: s + "",
|
|
@@ -1353,8 +1369,8 @@ function Gt(e, t) {
|
|
|
1353
1369
|
"stroke-width": n.borderWidth
|
|
1354
1370
|
}), i;
|
|
1355
1371
|
}
|
|
1356
|
-
function
|
|
1357
|
-
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = A(e.nodes, t), r = document.createElementNS(
|
|
1372
|
+
function Y(e, t, n = !1) {
|
|
1373
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = A(e.nodes, t), r = document.createElementNS(S, "rect");
|
|
1358
1374
|
x(r, {
|
|
1359
1375
|
x: s + "",
|
|
1360
1376
|
y: i + "",
|
|
@@ -1366,13 +1382,13 @@ function X(e, t, n = !1) {
|
|
|
1366
1382
|
stroke: o.borderColor,
|
|
1367
1383
|
"stroke-width": o.borderWidth
|
|
1368
1384
|
});
|
|
1369
|
-
const l = document.createElementNS(
|
|
1385
|
+
const l = document.createElementNS(S, "g");
|
|
1370
1386
|
l.appendChild(r);
|
|
1371
1387
|
let c;
|
|
1372
|
-
return n ? c =
|
|
1388
|
+
return n ? c = Gt(t, o, s, i) : c = Yt(t, o, s, i), l.appendChild(c), l;
|
|
1373
1389
|
}
|
|
1374
|
-
function
|
|
1375
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = A(e.nodes, t), i = document.createElementNS(
|
|
1390
|
+
function Ut(e, t) {
|
|
1391
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = A(e.nodes, t), i = document.createElementNS(S, "a"), r = document.createElementNS(S, "text");
|
|
1376
1392
|
return x(r, {
|
|
1377
1393
|
x: o + "",
|
|
1378
1394
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -1383,8 +1399,8 @@ function Kt(e, t) {
|
|
|
1383
1399
|
fill: `${n.color}`
|
|
1384
1400
|
}), r.innerHTML = t.textContent, i.appendChild(r), i.setAttribute("href", t.href), i;
|
|
1385
1401
|
}
|
|
1386
|
-
function
|
|
1387
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = A(e.nodes, t), i = document.createElementNS(
|
|
1402
|
+
function Jt(e, t) {
|
|
1403
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = A(e.nodes, t), i = document.createElementNS(S, "image");
|
|
1388
1404
|
return x(i, {
|
|
1389
1405
|
x: o + "",
|
|
1390
1406
|
y: s + "",
|
|
@@ -1393,9 +1409,9 @@ function Ut(e, t) {
|
|
|
1393
1409
|
href: t.src
|
|
1394
1410
|
}), i;
|
|
1395
1411
|
}
|
|
1396
|
-
const G = 100,
|
|
1412
|
+
const G = 100, Qt = '<?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">', Zt = (e, t = !1) => {
|
|
1397
1413
|
var u, a, p;
|
|
1398
|
-
const n = e.nodes, o = n.offsetHeight + G * 2, s = n.offsetWidth + G * 2, i =
|
|
1414
|
+
const n = e.nodes, o = n.offsetHeight + G * 2, s = n.offsetWidth + G * 2, i = Wt(o + "px", s + "px"), r = document.createElementNS(S, "svg"), l = document.createElementNS(S, "rect");
|
|
1399
1415
|
x(l, {
|
|
1400
1416
|
x: "0",
|
|
1401
1417
|
y: "0",
|
|
@@ -1412,22 +1428,22 @@ const G = 100, Jt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "
|
|
|
1412
1428
|
d && r.appendChild(d);
|
|
1413
1429
|
const h = (p = n.querySelector(".summary")) == null ? void 0 : p.cloneNode(!0);
|
|
1414
1430
|
return h && r.appendChild(h), n.querySelectorAll("me-tpc").forEach((m) => {
|
|
1415
|
-
m.nodeObj.dangerouslySetInnerHTML ? r.appendChild(
|
|
1431
|
+
m.nodeObj.dangerouslySetInnerHTML ? r.appendChild(Y(e, m, !t)) : (r.appendChild(Kt(e, m)), r.appendChild(Y(e, m.text, !t)));
|
|
1416
1432
|
}), n.querySelectorAll(".tags > span").forEach((m) => {
|
|
1417
|
-
r.appendChild(
|
|
1433
|
+
r.appendChild(Y(e, m));
|
|
1418
1434
|
}), n.querySelectorAll(".icons > span").forEach((m) => {
|
|
1419
|
-
r.appendChild(
|
|
1435
|
+
r.appendChild(Y(e, m));
|
|
1420
1436
|
}), n.querySelectorAll(".hyper-link").forEach((m) => {
|
|
1421
|
-
r.appendChild(Kt(e, m));
|
|
1422
|
-
}), n.querySelectorAll("img").forEach((m) => {
|
|
1423
1437
|
r.appendChild(Ut(e, m));
|
|
1438
|
+
}), n.querySelectorAll("img").forEach((m) => {
|
|
1439
|
+
r.appendChild(Jt(e, m));
|
|
1424
1440
|
}), x(r, {
|
|
1425
1441
|
x: G + "",
|
|
1426
1442
|
y: G + "",
|
|
1427
1443
|
overflow: "visible"
|
|
1428
1444
|
}), i.appendChild(r), i;
|
|
1429
|
-
},
|
|
1430
|
-
function
|
|
1445
|
+
}, en = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Qt + e.outerHTML);
|
|
1446
|
+
function tn(e) {
|
|
1431
1447
|
return new Promise((t, n) => {
|
|
1432
1448
|
const o = new FileReader();
|
|
1433
1449
|
o.onload = (s) => {
|
|
@@ -1437,11 +1453,11 @@ function en(e) {
|
|
|
1437
1453
|
}, o.readAsDataURL(e);
|
|
1438
1454
|
});
|
|
1439
1455
|
}
|
|
1440
|
-
const
|
|
1441
|
-
const n =
|
|
1456
|
+
const nn = function(e = !1, t) {
|
|
1457
|
+
const n = Zt(this, e), o = en(n, t);
|
|
1442
1458
|
return new Blob([o], { type: "image/svg+xml" });
|
|
1443
|
-
},
|
|
1444
|
-
const n = this.exportSvg(e, t), o = await
|
|
1459
|
+
}, on = async function(e = !1, t) {
|
|
1460
|
+
const n = this.exportSvg(e, t), o = await tn(n);
|
|
1445
1461
|
return new Promise((s, i) => {
|
|
1446
1462
|
const r = new Image();
|
|
1447
1463
|
r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
|
|
@@ -1449,13 +1465,13 @@ const tn = function(e = !1, t) {
|
|
|
1449
1465
|
l.width = r.width, l.height = r.height, l.getContext("2d").drawImage(r, 0, 0), l.toBlob(s, "image/png", 1);
|
|
1450
1466
|
}, r.src = o, r.onerror = i;
|
|
1451
1467
|
});
|
|
1452
|
-
},
|
|
1468
|
+
}, sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1453
1469
|
__proto__: null,
|
|
1454
|
-
exportPng:
|
|
1455
|
-
exportSvg:
|
|
1456
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1470
|
+
exportPng: on,
|
|
1471
|
+
exportSvg: nn
|
|
1472
|
+
}, Symbol.toStringTag, { value: "Module" })), rn = {}, ln = {
|
|
1457
1473
|
getObjById: K,
|
|
1458
|
-
generateNewObj:
|
|
1474
|
+
generateNewObj: Ae,
|
|
1459
1475
|
layout: De,
|
|
1460
1476
|
linkDiv: Ie,
|
|
1461
1477
|
editTopic: qe,
|
|
@@ -1464,19 +1480,19 @@ const tn = function(e = !1, t) {
|
|
|
1464
1480
|
createChildren: je,
|
|
1465
1481
|
createTopic: Oe,
|
|
1466
1482
|
findEle: L,
|
|
1467
|
-
changeTheme:
|
|
1468
|
-
...
|
|
1483
|
+
changeTheme: tt,
|
|
1484
|
+
...Et,
|
|
1485
|
+
...rn,
|
|
1486
|
+
...Dt,
|
|
1487
|
+
...Ft,
|
|
1469
1488
|
...sn,
|
|
1470
|
-
...kt,
|
|
1471
|
-
...It,
|
|
1472
|
-
...on,
|
|
1473
1489
|
init(e) {
|
|
1474
1490
|
if (!e || !e.nodeData)
|
|
1475
1491
|
return new Error("MindElixir: `data` is required");
|
|
1476
|
-
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, te(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar &&
|
|
1492
|
+
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, te(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && Xe(this), this.toCenter(), this.layout(), this.linkDiv();
|
|
1477
1493
|
}
|
|
1478
1494
|
};
|
|
1479
|
-
function
|
|
1495
|
+
function cn({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: l, direction: c, containerHeight: d }) {
|
|
1480
1496
|
let h = t + n / 2;
|
|
1481
1497
|
const u = e + o / 2;
|
|
1482
1498
|
let a;
|
|
@@ -1484,16 +1500,16 @@ function ln({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: l, direction:
|
|
|
1484
1500
|
const p = s + l / 2, f = (1 - Math.abs(p - u) / d) * 0.25 * (n / 2);
|
|
1485
1501
|
return c === "lhs" ? h = h - n / 10 - f : h = h + n / 10 + f, `M ${h} ${u} Q ${h} ${p} ${a} ${p}`;
|
|
1486
1502
|
}
|
|
1487
|
-
function
|
|
1503
|
+
function an({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: l, direction: c, isFirst: d }) {
|
|
1488
1504
|
let h = 0, u = 0;
|
|
1489
1505
|
d ? h = e + o / 2 : h = e + o;
|
|
1490
1506
|
const a = s + l;
|
|
1491
1507
|
let p = 0, m = 0, f = 0;
|
|
1492
|
-
const g = Math.abs(h - a) / 300 *
|
|
1493
|
-
return c === "lhs" ? (f = t, p = f +
|
|
1508
|
+
const g = Math.abs(h - a) / 300 * $;
|
|
1509
|
+
return c === "lhs" ? (f = t, p = f + $, m = f - $, u = i + $, `M ${p} ${h} C ${f} ${h} ${f + g} ${a} ${m} ${a} H ${u}`) : (f = t + n, p = f - $, m = f + $, u = i + r - $, `M ${p} ${h} C ${f} ${h} ${f - g} ${a} ${m} ${a} H ${u}`);
|
|
1494
1510
|
}
|
|
1495
1511
|
const V = document;
|
|
1496
|
-
function
|
|
1512
|
+
function N({
|
|
1497
1513
|
el: e,
|
|
1498
1514
|
direction: t,
|
|
1499
1515
|
locale: n,
|
|
@@ -1513,25 +1529,24 @@ function M({
|
|
|
1513
1529
|
mobileMenu: g,
|
|
1514
1530
|
theme: y
|
|
1515
1531
|
}) {
|
|
1516
|
-
console.log("ME_version " + M.version, this);
|
|
1517
1532
|
let v = null;
|
|
1518
1533
|
const w = Object.prototype.toString.call(e);
|
|
1519
1534
|
if (w === "[object HTMLDivElement]" ? v = e : w === "[object String]" && (v = document.querySelector(e)), !v)
|
|
1520
1535
|
throw new Error("MindElixir: el is not a valid element");
|
|
1521
|
-
v.className += " mind-elixir", v.innerHTML = "", v.style.setProperty("--gap",
|
|
1536
|
+
v.className += " mind-elixir", v.innerHTML = "", v.style.setProperty("--gap", $ + "px"), this.mindElixirBox = v, this.before = h || {}, this.locale = n || "en", this.contextMenuOption = r, this.contextMenu = i === void 0 ? !0 : i, this.toolBar = l === void 0 ? !0 : l, this.keypress = c === void 0 ? !0 : c, this.mouseSelectionButton = d || 0, this.mobileMenu = g || !1, this.direction = typeof t == "number" ? t : 1, this.draggable = o === void 0 ? !0 : o, this.newTopicName = u || "new node", this.editable = s === void 0 ? !0 : s, this.allowUndo = a === void 0 ? !1 : a, this.currentNode = null, this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.generateMainBranch = p || cn, this.generateSubBranch = m || an, this.overflowHidden = f || !1, this.bus = ke.create(), this.container = V.createElement("div"), this.container.className = "map-container";
|
|
1522
1537
|
const E = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1523
1538
|
this.theme = y || (E.matches ? ve : ge);
|
|
1524
1539
|
const _ = V.createElement("div");
|
|
1525
|
-
_.className = "map-canvas", this.map = _, this.map.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.mindElixirBox.appendChild(this.container), this.nodes = V.createElement("me-nodes"), this.nodes.className = "main-node-container", this.lines = I("lines"), this.summarySvg = I("summary"), this.linkController = I("linkcontroller"), this.P2 = V.createElement("div"), this.P3 = V.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = le(), this.line2 = le(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = I("topiclinks"), this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" :
|
|
1540
|
+
_.className = "map-canvas", this.map = _, this.map.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.mindElixirBox.appendChild(this.container), this.nodes = V.createElement("me-nodes"), this.nodes.className = "main-node-container", this.lines = I("lines"), this.summarySvg = I("summary"), this.linkController = I("linkcontroller"), this.P2 = V.createElement("div"), this.P3 = V.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = le(), this.line2 = le(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = I("topiclinks"), this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : Ne(this);
|
|
1526
1541
|
}
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1542
|
+
N.prototype = ln;
|
|
1543
|
+
N.LEFT = q;
|
|
1544
|
+
N.RIGHT = Z;
|
|
1545
|
+
N.SIDE = ee;
|
|
1546
|
+
N.THEME = ge;
|
|
1547
|
+
N.DARK_THEME = ve;
|
|
1548
|
+
N.version = "4.0.3";
|
|
1549
|
+
N.E = L;
|
|
1535
1550
|
export {
|
|
1536
|
-
|
|
1551
|
+
N as default
|
|
1537
1552
|
};
|