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