mind-elixir 4.3.4 → 4.3.5
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 +6 -6
- package/dist/MindElixir.js +80 -77
- package/dist/MindElixirLite.iife.js +2 -2
- package/dist/MindElixirLite.js +78 -75
- package/dist/types/index.d.ts +8 -0
- package/package.json +1 -1
package/dist/MindElixir.js
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
s.readyState == "complete" && (s.onreadystatechange = null, u());
|
|
30
30
|
});
|
|
31
31
|
})(window);
|
|
32
|
-
const
|
|
32
|
+
const k = 0, D = 1, ie = 2, Oe = {
|
|
33
33
|
name: "Latte",
|
|
34
34
|
type: "light",
|
|
35
35
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -134,7 +134,7 @@ const O = (e, t) => {
|
|
|
134
134
|
return !1;
|
|
135
135
|
}
|
|
136
136
|
return !0;
|
|
137
|
-
}),
|
|
137
|
+
}), S = {
|
|
138
138
|
moved: !1,
|
|
139
139
|
// diffrentiate click and move
|
|
140
140
|
mousedown: !1,
|
|
@@ -146,7 +146,9 @@ const O = (e, t) => {
|
|
|
146
146
|
}
|
|
147
147
|
},
|
|
148
148
|
clear() {
|
|
149
|
-
|
|
149
|
+
setTimeout(() => {
|
|
150
|
+
this.moved = !1, this.mousedown = !1;
|
|
151
|
+
}, 0);
|
|
150
152
|
}
|
|
151
153
|
};
|
|
152
154
|
function st(e) {
|
|
@@ -162,8 +164,8 @@ function st(e) {
|
|
|
162
164
|
e.helper2.clear();
|
|
163
165
|
return;
|
|
164
166
|
}
|
|
165
|
-
if (
|
|
166
|
-
|
|
167
|
+
if (S.moved) {
|
|
168
|
+
S.clear();
|
|
167
169
|
return;
|
|
168
170
|
}
|
|
169
171
|
e.clearSelection();
|
|
@@ -182,16 +184,16 @@ function st(e) {
|
|
|
182
184
|
const n = t.target;
|
|
183
185
|
le(n) ? e.beginEdit(n) : n.tagName === "text" && (n.dataset.type === "custom-link" ? e.editArrowLabel(n.parentElement) : e.editSummary(n.parentElement));
|
|
184
186
|
}), e.map.addEventListener("mousemove", (t) => {
|
|
185
|
-
t.target.contentEditable !== "true" &&
|
|
187
|
+
t.target.contentEditable !== "true" && S.onMove(t, e.container);
|
|
186
188
|
}), e.map.addEventListener("mousedown", (t) => {
|
|
187
189
|
const n = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
188
|
-
t.button === n && t.target.contentEditable !== "true" && (
|
|
190
|
+
t.button === n && t.target.contentEditable !== "true" && (S.moved = !1, S.mousedown = !0);
|
|
189
191
|
}), e.map.addEventListener("mouseleave", (t) => {
|
|
190
192
|
const n = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
191
|
-
t.button === n &&
|
|
193
|
+
t.button === n && S.clear();
|
|
192
194
|
}), e.map.addEventListener("mouseup", (t) => {
|
|
193
195
|
const n = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
194
|
-
t.button === n &&
|
|
196
|
+
t.button === n && S.clear();
|
|
195
197
|
});
|
|
196
198
|
}
|
|
197
199
|
const it = {
|
|
@@ -232,7 +234,7 @@ const it = {
|
|
|
232
234
|
if (this.direction === ie) {
|
|
233
235
|
let o = 0, s = 0;
|
|
234
236
|
n.map((i) => {
|
|
235
|
-
i.direction ===
|
|
237
|
+
i.direction === k ? o += 1 : i.direction === D ? s += 1 : o <= s ? (i.direction = k, o += 1) : (i.direction = D, s += 1);
|
|
236
238
|
});
|
|
237
239
|
}
|
|
238
240
|
lt(this, n, t);
|
|
@@ -243,7 +245,7 @@ const it = {
|
|
|
243
245
|
s.className = "rhs";
|
|
244
246
|
for (let i = 0; i < t.length; i++) {
|
|
245
247
|
const r = t[i], { grp: l } = e.createWrapper(r);
|
|
246
|
-
e.direction === ie ? r.direction ===
|
|
248
|
+
e.direction === ie ? r.direction === k ? o.appendChild(l) : s.appendChild(l) : e.direction === k ? o.appendChild(l) : s.appendChild(l);
|
|
247
249
|
}
|
|
248
250
|
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines);
|
|
249
251
|
}, ct = function(e, t) {
|
|
@@ -253,8 +255,8 @@ const it = {
|
|
|
253
255
|
n.appendChild(i);
|
|
254
256
|
}
|
|
255
257
|
return n;
|
|
256
|
-
},
|
|
257
|
-
const o = (t ? t.mindElixirBox :
|
|
258
|
+
}, _ = document, N = (e, t) => {
|
|
259
|
+
const o = (t ? t.mindElixirBox : _).querySelector(`[data-nodeid=me${e}]`);
|
|
258
260
|
if (!o)
|
|
259
261
|
throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
260
262
|
return o;
|
|
@@ -266,32 +268,32 @@ const it = {
|
|
|
266
268
|
if (t.image) {
|
|
267
269
|
const n = t.image;
|
|
268
270
|
if (n.url && n.width && n.height) {
|
|
269
|
-
const o =
|
|
271
|
+
const o = _.createElement("img");
|
|
270
272
|
o.src = n.url, o.style.width = n.width + "px", o.style.height = n.height + "px", n.fit && (o.style.objectFit = n.fit), e.appendChild(o), e.image = o;
|
|
271
273
|
}
|
|
272
274
|
} else
|
|
273
275
|
e.image && (e.image = void 0);
|
|
274
276
|
{
|
|
275
|
-
const n =
|
|
277
|
+
const n = _.createElement("span");
|
|
276
278
|
n.className = "text", n.textContent = t.topic, e.appendChild(n), e.text = n;
|
|
277
279
|
}
|
|
278
280
|
if (t.hyperLink) {
|
|
279
|
-
const n =
|
|
281
|
+
const n = _.createElement("a");
|
|
280
282
|
n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = t.hyperLink, e.appendChild(n), e.link = n;
|
|
281
283
|
} else
|
|
282
284
|
e.link && (e.link = void 0);
|
|
283
285
|
if (t.icons && t.icons.length) {
|
|
284
|
-
const n =
|
|
286
|
+
const n = _.createElement("span");
|
|
285
287
|
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${te(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
|
|
286
288
|
} else
|
|
287
289
|
e.icons && (e.icons = void 0);
|
|
288
290
|
if (t.tags && t.tags.length) {
|
|
289
|
-
const n =
|
|
291
|
+
const n = _.createElement("div");
|
|
290
292
|
n.className = "tags", n.innerHTML = t.tags.map((o) => `<span>${te(o)}</span>`).join(""), e.appendChild(n), e.tags = n;
|
|
291
293
|
} else
|
|
292
294
|
e.tags && (e.tags = void 0);
|
|
293
295
|
}, at = function(e, t) {
|
|
294
|
-
const n =
|
|
296
|
+
const n = _.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
|
|
295
297
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
296
298
|
const i = fe(e.expanded);
|
|
297
299
|
if (o.appendChild(i), e.expanded !== !1) {
|
|
@@ -301,17 +303,17 @@ const it = {
|
|
|
301
303
|
}
|
|
302
304
|
return { grp: n, top: o, tpc: s };
|
|
303
305
|
}, dt = function(e) {
|
|
304
|
-
const t =
|
|
306
|
+
const t = _.createElement("me-parent"), n = this.createTopic(e);
|
|
305
307
|
return ue(n, e), t.appendChild(n), { p: t, tpc: n };
|
|
306
308
|
}, ht = function(e) {
|
|
307
|
-
const t =
|
|
309
|
+
const t = _.createElement("me-children");
|
|
308
310
|
return t.append(...e), t;
|
|
309
311
|
}, ut = function(e) {
|
|
310
|
-
const t =
|
|
312
|
+
const t = _.createElement("me-tpc");
|
|
311
313
|
return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t.draggable = this.draggable, t;
|
|
312
314
|
};
|
|
313
315
|
function He(e) {
|
|
314
|
-
const t =
|
|
316
|
+
const t = _.createRange();
|
|
315
317
|
t.selectNodeContents(e);
|
|
316
318
|
const n = window.getSelection();
|
|
317
319
|
n && (n.removeAllRanges(), n.addRange(t));
|
|
@@ -319,7 +321,7 @@ function He(e) {
|
|
|
319
321
|
const ft = function(e) {
|
|
320
322
|
if (!e)
|
|
321
323
|
return;
|
|
322
|
-
const t =
|
|
324
|
+
const t = _.createElement("div"), n = e.text.textContent;
|
|
323
325
|
e.appendChild(t), t.id = "input-box", t.textContent = n, t.contentEditable = "true", t.spellcheck = !1;
|
|
324
326
|
const o = getComputedStyle(e);
|
|
325
327
|
t.style.cssText = `min-width:${e.offsetWidth - 8}px;
|
|
@@ -328,7 +330,7 @@ const ft = function(e) {
|
|
|
328
330
|
margin:${o.margin};
|
|
329
331
|
font:${o.font};
|
|
330
332
|
background-color:${o.backgroundColor !== "rgba(0, 0, 0, 0)" && o.backgroundColor};
|
|
331
|
-
border-radius:${o.borderRadius};`, this.direction ===
|
|
333
|
+
border-radius:${o.borderRadius};`, this.direction === k && (t.style.right = "0"), t.focus(), He(t), this.bus.fire("operation", {
|
|
332
334
|
name: "beginEdit",
|
|
333
335
|
obj: e.nodeObj
|
|
334
336
|
}), t.addEventListener("keydown", (s) => {
|
|
@@ -351,7 +353,7 @@ const ft = function(e) {
|
|
|
351
353
|
}));
|
|
352
354
|
});
|
|
353
355
|
}, fe = function(e) {
|
|
354
|
-
const t =
|
|
356
|
+
const t = _.createElement("me-epd");
|
|
355
357
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
356
358
|
}, q = document, I = "http://www.w3.org/2000/svg", ze = function(e, t, n) {
|
|
357
359
|
const o = q.createElementNS(I, "path");
|
|
@@ -591,11 +593,11 @@ function gt(e, t) {
|
|
|
591
593
|
v.className = "context-menu", v.appendChild(h), v.hidden = !0, e.container.append(v);
|
|
592
594
|
let y = !0;
|
|
593
595
|
return e.container.oncontextmenu = function(b) {
|
|
594
|
-
if (b.preventDefault(), !e.editable)
|
|
596
|
+
if (b.preventDefault(), !e.editable || S.moved)
|
|
595
597
|
return;
|
|
596
598
|
const x = b.target;
|
|
597
599
|
if (le(x)) {
|
|
598
|
-
x.parentElement.tagName === "ME-ROOT" ? y = !0 : y = !1, y ? (d.className = "disabled", f.className = "disabled", g.className = "disabled", l.className = "disabled", c.className = "disabled", u.className = "disabled") : (d.className = "", f.className = "", g.className = "", l.className = "", c.className = "", u.className = ""), e.currentNodes || e.selectNode(x), v.hidden = !1,
|
|
600
|
+
x.parentElement.tagName === "ME-ROOT" ? y = !0 : y = !1, y ? (d.className = "disabled", f.className = "disabled", g.className = "disabled", l.className = "disabled", c.className = "disabled", u.className = "disabled") : (d.className = "", f.className = "", g.className = "", l.className = "", c.className = "", u.className = ""), e.currentNodes || e.selectNode(x), v.hidden = !1, S.mousedown && (S.mousedown = !1), h.style.top = "", h.style.bottom = "", h.style.left = "", h.style.right = "";
|
|
599
601
|
const w = h.getBoundingClientRect(), C = h.offsetHeight, P = h.offsetWidth, V = b.clientY - w.top, B = b.clientX - w.left;
|
|
600
602
|
C + V > window.innerHeight ? (h.style.top = "", h.style.bottom = "0px") : (h.style.bottom = "", h.style.top = V + 15 + "px"), P + B > window.innerWidth ? (h.style.left = "", h.style.right = "0px") : (h.style.right = "", h.style.left = B + 10 + "px");
|
|
601
603
|
}
|
|
@@ -796,7 +798,7 @@ function St(e) {
|
|
|
796
798
|
(c = e.currentNodes) != null && c.includes(l) || (e.unselectNodes(), e.selectNode(l)), e.currentNodes ? (t = e.currentNodes, s.innerHTML = e.currentNodes.length + " nodes") : (t = [l], s.innerHTML = l.innerHTML);
|
|
797
799
|
for (const d of t)
|
|
798
800
|
d.parentElement.parentElement.style.opacity = "0.5";
|
|
799
|
-
(u = r.dataTransfer) == null || u.setDragImage(s, 0, 0),
|
|
801
|
+
(u = r.dataTransfer) == null || u.setDragImage(s, 0, 0), S.clear();
|
|
800
802
|
}), e.map.addEventListener("dragend", async (r) => {
|
|
801
803
|
if (!t)
|
|
802
804
|
return;
|
|
@@ -890,7 +892,7 @@ function kt(e) {
|
|
|
890
892
|
e.scaleVal > 1.6 || e.scale(e.scaleVal + 0.2);
|
|
891
893
|
}, t;
|
|
892
894
|
}
|
|
893
|
-
function
|
|
895
|
+
function Tt(e) {
|
|
894
896
|
const t = document.createElement("div"), n = z("tbltl", "left"), o = z("tbltr", "right"), s = z("tblts", "side");
|
|
895
897
|
return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
896
898
|
e.initLeft();
|
|
@@ -900,8 +902,8 @@ function Lt(e) {
|
|
|
900
902
|
e.initSide();
|
|
901
903
|
}, t;
|
|
902
904
|
}
|
|
903
|
-
function
|
|
904
|
-
e.container.append(kt(e)), e.container.append(
|
|
905
|
+
function Lt(e) {
|
|
906
|
+
e.container.append(kt(e)), e.container.append(Tt(e));
|
|
905
907
|
}
|
|
906
908
|
/*! @viselect/vanilla v3.7.1 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */
|
|
907
909
|
class At {
|
|
@@ -965,7 +967,7 @@ const Ce = (e, t = "px") => typeof e == "number" ? e + t : e, A = ({ style: e },
|
|
|
965
967
|
for (const r of n)
|
|
966
968
|
i[e](r, o, { capture: !1, ...s });
|
|
967
969
|
return [t, n, o, s];
|
|
968
|
-
}, j = qe("addEventListener"),
|
|
970
|
+
}, j = qe("addEventListener"), T = qe("removeEventListener"), Z = (e) => {
|
|
969
971
|
var t;
|
|
970
972
|
const { clientX: n, clientY: o, target: s } = ((t = e.touches) == null ? void 0 : t[0]) ?? e;
|
|
971
973
|
return { x: n, y: o, target: s };
|
|
@@ -996,7 +998,7 @@ const Ce = (e, t = "px") => typeof e == "number" ? e + t : e, A = ({ style: e },
|
|
|
996
998
|
}
|
|
997
999
|
}
|
|
998
1000
|
return !1;
|
|
999
|
-
}, { abs: H, max: Me, min: ke, ceil:
|
|
1001
|
+
}, { abs: H, max: Me, min: ke, ceil: Te } = Math, Le = (e = []) => ({
|
|
1000
1002
|
stored: e,
|
|
1001
1003
|
selected: [],
|
|
1002
1004
|
touched: [],
|
|
@@ -1004,7 +1006,7 @@ const Ce = (e, t = "px") => typeof e == "number" ? e + t : e, A = ({ style: e },
|
|
|
1004
1006
|
}), Ie = class extends At {
|
|
1005
1007
|
constructor(t) {
|
|
1006
1008
|
var n, o, s, i, r;
|
|
1007
|
-
super(), this._selection =
|
|
1009
|
+
super(), this._selection = Le(), this._targetBoundaryScrolled = !0, this._selectables = [], this._areaLocation = { y1: 0, x2: 0, y2: 0, x1: 0 }, this._areaRect = Se(), this._singleClick = !0, this._scrollAvailable = !0, this._scrollingActive = !1, this._scrollSpeed = { x: 0, y: 0 }, this._scrollDelta = { x: 0, y: 0 }, this._lastMousePosition = { x: 0, y: 0 }, this.disable = this._toggleStartEvents.bind(this, !1), this.enable = this._toggleStartEvents, this._options = {
|
|
1008
1010
|
selectionAreaClass: "selection-area",
|
|
1009
1011
|
selectionContainerClass: void 0,
|
|
1010
1012
|
selectables: [],
|
|
@@ -1062,7 +1064,7 @@ const Ce = (e, t = "px") => typeof e == "number" ? e + t : e, A = ({ style: e },
|
|
|
1062
1064
|
}), this.enable();
|
|
1063
1065
|
}
|
|
1064
1066
|
_toggleStartEvents(t = !0) {
|
|
1065
|
-
const { document: n, features: o } = this._options, s = t ? j :
|
|
1067
|
+
const { document: n, features: o } = this._options, s = t ? j : T;
|
|
1066
1068
|
s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, { passive: !1 });
|
|
1067
1069
|
}
|
|
1068
1070
|
_onTapStart(t, n = !1) {
|
|
@@ -1118,8 +1120,8 @@ const Ce = (e, t = "px") => typeof e == "number" ? e + t : e, A = ({ style: e },
|
|
|
1118
1120
|
typeof s == "number" && H(l + c - (i + r)) >= s || // Different x and y threshold
|
|
1119
1121
|
typeof s == "object" && H(l - i) >= s.x || H(c - r) >= s.y
|
|
1120
1122
|
) {
|
|
1121
|
-
if (
|
|
1122
|
-
|
|
1123
|
+
if (T(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1124
|
+
T(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
|
|
1123
1125
|
return;
|
|
1124
1126
|
}
|
|
1125
1127
|
j(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), A(this._area, "display", "block"), R(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 && (j(this._targetElement, "wheel", this._wheelScroll, { passive: !1 }), j(this._options.document, "keydown", this._keyboardScroll, { passive: !1 }), this._selectables = this._selectables.filter((u) => this._targetElement.contains(u))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
|
|
@@ -1156,7 +1158,7 @@ const Ce = (e, t = "px") => typeof e == "number" ? e + t : e, A = ({ style: e },
|
|
|
1156
1158
|
return;
|
|
1157
1159
|
}
|
|
1158
1160
|
const { scrollTop: a, scrollLeft: f } = l;
|
|
1159
|
-
n.y && (l.scrollTop +=
|
|
1161
|
+
n.y && (l.scrollTop += Te(n.y / r), o.y1 -= l.scrollTop - a), n.x && (l.scrollLeft += Te(n.x / r), o.x1 -= l.scrollLeft - f), i.next(t), requestAnimationFrame(d);
|
|
1160
1162
|
};
|
|
1161
1163
|
requestAnimationFrame(d);
|
|
1162
1164
|
} else
|
|
@@ -1172,7 +1174,7 @@ const Ce = (e, t = "px") => typeof e == "number" ? e + t : e, A = ({ style: e },
|
|
|
1172
1174
|
this._areaLocation.x1 += t.x - s, this._areaLocation.y1 += t.y - o, t.x = s, t.y = o, this._setupSelectionArea(), this._frame.next(null);
|
|
1173
1175
|
}
|
|
1174
1176
|
_onStartAreaScroll() {
|
|
1175
|
-
this._targetBoundaryScrolled = !0,
|
|
1177
|
+
this._targetBoundaryScrolled = !0, T(this._targetElement, "scroll", this._onStartAreaScroll);
|
|
1176
1178
|
}
|
|
1177
1179
|
_wheelScroll(t) {
|
|
1178
1180
|
const { manualSpeed: n } = this._options.behaviour.scrolling, o = t.deltaY ? t.deltaY > 0 ? 1 : -1 : 0, s = t.deltaX ? t.deltaX > 0 ? 1 : -1 : 0;
|
|
@@ -1202,7 +1204,7 @@ const Ce = (e, t = "px") => typeof e == "number" ? e + t : e, A = ({ style: e },
|
|
|
1202
1204
|
_onTapStop(t, n) {
|
|
1203
1205
|
var o;
|
|
1204
1206
|
const { document: s, features: i } = this._options, { _singleClick: r } = this;
|
|
1205
|
-
|
|
1207
|
+
T(this._targetElement, "scroll", this._onStartAreaScroll), 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._wheelScroll, { passive: !0 }), T(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), (o = this._frame) == null || o.cancel(), A(this._area, "display", "none");
|
|
1206
1208
|
}
|
|
1207
1209
|
_updateElementSelection() {
|
|
1208
1210
|
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: r, touched: l } = o, { intersect: c, overlap: u } = n.behaviour, d = u === "invert", a = [], f = [], g = [];
|
|
@@ -1290,7 +1292,7 @@ const Ce = (e, t = "px") => typeof e == "number" ? e + t : e, A = ({ style: e },
|
|
|
1290
1292
|
i.added = [], i.removed.push(
|
|
1291
1293
|
...o,
|
|
1292
1294
|
...t ? s : []
|
|
1293
|
-
), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection =
|
|
1295
|
+
), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Le(t ? [] : s);
|
|
1294
1296
|
}
|
|
1295
1297
|
/**
|
|
1296
1298
|
* @returns {Array} Selected elements
|
|
@@ -1378,7 +1380,7 @@ function Bt(e) {
|
|
|
1378
1380
|
changed: { added: o, removed: s }
|
|
1379
1381
|
}
|
|
1380
1382
|
}) => {
|
|
1381
|
-
|
|
1383
|
+
S.moved = !0;
|
|
1382
1384
|
for (const i of o)
|
|
1383
1385
|
i.classList.add("selected");
|
|
1384
1386
|
for (const i of s)
|
|
@@ -1442,13 +1444,13 @@ function Ke(e, t, n) {
|
|
|
1442
1444
|
}
|
|
1443
1445
|
const It = function(e, t) {
|
|
1444
1446
|
var n, o;
|
|
1445
|
-
if (e ===
|
|
1446
|
-
return
|
|
1447
|
+
if (e === k)
|
|
1448
|
+
return k;
|
|
1447
1449
|
if (e === D)
|
|
1448
1450
|
return D;
|
|
1449
1451
|
if (e === ie) {
|
|
1450
1452
|
const s = ((n = document.querySelector(".lhs")) == null ? void 0 : n.childElementCount) || 0, i = ((o = document.querySelector(".rhs")) == null ? void 0 : o.childElementCount) || 0;
|
|
1451
|
-
return s <= i ? (t.direction =
|
|
1453
|
+
return s <= i ? (t.direction = k, k) : (t.direction = D, D);
|
|
1452
1454
|
}
|
|
1453
1455
|
}, Ve = function(e, t, n) {
|
|
1454
1456
|
var i, r;
|
|
@@ -1462,7 +1464,7 @@ const It = function(e, t) {
|
|
|
1462
1464
|
}
|
|
1463
1465
|
e.linkDiv(n.offsetParent);
|
|
1464
1466
|
} else
|
|
1465
|
-
s.tagName === "ME-ROOT" && (It(e.direction, o.nodeObj) ===
|
|
1467
|
+
s.tagName === "ME-ROOT" && (It(e.direction, o.nodeObj) === k ? (i = e.container.querySelector(".lhs")) == null || i.appendChild(n) : (r = e.container.querySelector(".rhs")) == null || r.appendChild(n), e.linkDiv());
|
|
1466
1468
|
}, We = function(e, t) {
|
|
1467
1469
|
const n = e.parentNode;
|
|
1468
1470
|
if (t === 0) {
|
|
@@ -1511,7 +1513,7 @@ const It = function(e, t) {
|
|
|
1511
1513
|
}
|
|
1512
1514
|
const i = n || this.generateNewObj();
|
|
1513
1515
|
if (!((f = s.parent) != null && f.parent)) {
|
|
1514
|
-
const g = o.offsetParent.offsetParent.parentElement.className === "lhs" ?
|
|
1516
|
+
const g = o.offsetParent.offsetParent.parentElement.className === "lhs" ? k : D;
|
|
1515
1517
|
i.direction = g;
|
|
1516
1518
|
}
|
|
1517
1519
|
Ft(i, e, s), $(this.nodeData);
|
|
@@ -1851,7 +1853,7 @@ function F(e) {
|
|
|
1851
1853
|
y: n
|
|
1852
1854
|
};
|
|
1853
1855
|
}
|
|
1854
|
-
const
|
|
1856
|
+
const Tn = function(e, t, n, o) {
|
|
1855
1857
|
const s = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
1856
1858
|
return E(s, {
|
|
1857
1859
|
"text-anchor": "middle",
|
|
@@ -1866,9 +1868,9 @@ const Ln = function(e, t, n, o) {
|
|
|
1866
1868
|
const i = se(e, t, o.delta1), r = se(e, n, o.delta2), { x: l, y: c } = F(i), { ctrlX: u, ctrlY: d } = i, { ctrlX: a, ctrlY: f } = r, { x: g, y: p } = F(r), m = Be(a, f, g, p), h = pt(
|
|
1867
1869
|
`M ${l} ${c} C ${u} ${d} ${a} ${f} ${g} ${p}`,
|
|
1868
1870
|
`M ${m.x1} ${m.y1} L ${g} ${p} L ${m.x2} ${m.y2}`
|
|
1869
|
-
), v = l / 8 + u * 3 / 8 + a * 3 / 8 + g / 8, y = c / 8 + d * 3 / 8 + f * 3 / 8 + p / 8, b =
|
|
1871
|
+
), v = l / 8 + u * 3 / 8 + a * 3 / 8 + g / 8, y = c / 8 + d * 3 / 8 + f * 3 / 8 + p / 8, b = Tn(o.label, v, y, e.theme.cssVar["--color"]);
|
|
1870
1872
|
h.appendChild(b), h.arrowObj = o, h.dataset.linkid = o.id, e.linkSvgGroup.appendChild(h), s || (e.arrows.push(o), e.currentArrow = h, Qe(e, o, i, r)), performance.now();
|
|
1871
|
-
},
|
|
1873
|
+
}, Ln = function(e, t) {
|
|
1872
1874
|
const n = {
|
|
1873
1875
|
id: Y(),
|
|
1874
1876
|
label: "Custom Link",
|
|
@@ -1982,7 +1984,7 @@ function Pn() {
|
|
|
1982
1984
|
}
|
|
1983
1985
|
const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1984
1986
|
__proto__: null,
|
|
1985
|
-
createArrow:
|
|
1987
|
+
createArrow: Ln,
|
|
1986
1988
|
editArrowLabel: On,
|
|
1987
1989
|
removeArrow: An,
|
|
1988
1990
|
renderArrow: $n,
|
|
@@ -2130,12 +2132,12 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2130
2132
|
renderSummary: Wn,
|
|
2131
2133
|
selectSummary: Kn,
|
|
2132
2134
|
unselectSummary: Vn
|
|
2133
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2135
|
+
}, Symbol.toStringTag, { value: "Module" })), M = "http://www.w3.org/2000/svg";
|
|
2134
2136
|
function Xn(e, t) {
|
|
2135
|
-
const n = document.createElementNS(
|
|
2137
|
+
const n = document.createElementNS(M, "svg");
|
|
2136
2138
|
return E(n, {
|
|
2137
2139
|
version: "1.1",
|
|
2138
|
-
xmlns:
|
|
2140
|
+
xmlns: M,
|
|
2139
2141
|
height: e,
|
|
2140
2142
|
width: t
|
|
2141
2143
|
}), n;
|
|
@@ -2144,11 +2146,11 @@ function Gn(e, t) {
|
|
|
2144
2146
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2145
2147
|
}
|
|
2146
2148
|
function Jn(e, t, n, o) {
|
|
2147
|
-
const s = document.createElementNS(
|
|
2149
|
+
const s = document.createElementNS(M, "g");
|
|
2148
2150
|
let i = "";
|
|
2149
2151
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
2150
2152
|
`).forEach((l, c) => {
|
|
2151
|
-
const u = document.createElementNS(
|
|
2153
|
+
const u = document.createElementNS(M, "text");
|
|
2152
2154
|
E(u, {
|
|
2153
2155
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2154
2156
|
y: o + parseInt(t.paddingTop) + Gn(t.lineHeight, t.fontSize) * (c + 1) + parseFloat(t.fontSize) * (c + 1) + "",
|
|
@@ -2164,7 +2166,7 @@ function Zn(e, t, n, o) {
|
|
|
2164
2166
|
var l;
|
|
2165
2167
|
let s = "";
|
|
2166
2168
|
(l = e.nodeObj) != null && l.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
2167
|
-
const i = document.createElementNS(
|
|
2169
|
+
const i = document.createElementNS(M, "foreignObject");
|
|
2168
2170
|
E(i, {
|
|
2169
2171
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2170
2172
|
y: o + parseInt(t.paddingTop) + "",
|
|
@@ -2178,7 +2180,7 @@ function Zn(e, t, n, o) {
|
|
|
2178
2180
|
}), r.innerHTML = s, i.appendChild(r), i;
|
|
2179
2181
|
}
|
|
2180
2182
|
function Qn(e, t) {
|
|
2181
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(
|
|
2183
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(M, "rect");
|
|
2182
2184
|
return E(i, {
|
|
2183
2185
|
x: o + "",
|
|
2184
2186
|
y: s + "",
|
|
@@ -2192,7 +2194,7 @@ function Qn(e, t) {
|
|
|
2192
2194
|
}), i;
|
|
2193
2195
|
}
|
|
2194
2196
|
function Q(e, t, n = !1) {
|
|
2195
|
-
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = O(e.nodes, t), r = document.createElementNS(
|
|
2197
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = O(e.nodes, t), r = document.createElementNS(M, "rect");
|
|
2196
2198
|
E(r, {
|
|
2197
2199
|
x: s + "",
|
|
2198
2200
|
y: i + "",
|
|
@@ -2204,13 +2206,13 @@ function Q(e, t, n = !1) {
|
|
|
2204
2206
|
stroke: o.borderColor,
|
|
2205
2207
|
"stroke-width": o.borderWidth
|
|
2206
2208
|
});
|
|
2207
|
-
const l = document.createElementNS(
|
|
2209
|
+
const l = document.createElementNS(M, "g");
|
|
2208
2210
|
l.appendChild(r);
|
|
2209
2211
|
let c;
|
|
2210
2212
|
return n ? c = Zn(t, o, s, i) : c = Jn(t, o, s, i), l.appendChild(c), l;
|
|
2211
2213
|
}
|
|
2212
2214
|
function eo(e, t) {
|
|
2213
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(
|
|
2215
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(M, "a"), r = document.createElementNS(M, "text");
|
|
2214
2216
|
return E(r, {
|
|
2215
2217
|
x: o + "",
|
|
2216
2218
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -2222,7 +2224,7 @@ function eo(e, t) {
|
|
|
2222
2224
|
}), r.innerHTML = t.textContent, i.appendChild(r), i.setAttribute("href", t.href), i;
|
|
2223
2225
|
}
|
|
2224
2226
|
function to(e, t) {
|
|
2225
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(
|
|
2227
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(M, "image");
|
|
2226
2228
|
return E(i, {
|
|
2227
2229
|
x: o + "",
|
|
2228
2230
|
y: s + "",
|
|
@@ -2233,7 +2235,7 @@ function to(e, t) {
|
|
|
2233
2235
|
}
|
|
2234
2236
|
const ee = 100, no = '<?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">', oo = (e, t = !1) => {
|
|
2235
2237
|
var a, f, g;
|
|
2236
|
-
const n = e.nodes, o = n.offsetHeight + ee * 2, s = n.offsetWidth + ee * 2, i = Xn(o + "px", s + "px"), r = document.createElementNS(
|
|
2238
|
+
const n = e.nodes, o = n.offsetHeight + ee * 2, s = n.offsetWidth + ee * 2, i = Xn(o + "px", s + "px"), r = document.createElementNS(M, "svg"), l = document.createElementNS(M, "rect");
|
|
2237
2239
|
E(l, {
|
|
2238
2240
|
x: "0",
|
|
2239
2241
|
y: "0",
|
|
@@ -2323,7 +2325,7 @@ const ho = {
|
|
|
2323
2325
|
init(e) {
|
|
2324
2326
|
if (!e || !e.nodeData)
|
|
2325
2327
|
return new Error("MindElixir: `data` is required");
|
|
2326
|
-
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, $(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar &&
|
|
2328
|
+
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, $(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && Lt(this), this.keypress && Et(this), this.editable && Bt(this), this.contextMenu && this.disposable.push(gt(this, this.contextMenuOption)), this.draggable && St(this), this.allowUndo && Mt(this), this.toCenter(), this.layout(), this.linkDiv();
|
|
2327
2329
|
},
|
|
2328
2330
|
destroy() {
|
|
2329
2331
|
var e;
|
|
@@ -2347,8 +2349,8 @@ function fo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: l, direction:
|
|
|
2347
2349
|
const v = Math.abs(a - g) / 300 * d;
|
|
2348
2350
|
return c === "lhs" ? (h = t, p = h + d, m = h - d, f = i + d, `M ${p} ${a} C ${h} ${a} ${h + v} ${g} ${m} ${g} H ${f}`) : (h = t + n, p = h - d, m = h + d, f = i + r - d, `M ${p} ${a} C ${h} ${a} ${h - v} ${g} ${m} ${g} H ${f}`);
|
|
2349
2351
|
}
|
|
2350
|
-
const po = "4.3.
|
|
2351
|
-
function
|
|
2352
|
+
const po = "4.3.5", W = document;
|
|
2353
|
+
function L({
|
|
2352
2354
|
el: e,
|
|
2353
2355
|
direction: t,
|
|
2354
2356
|
locale: n,
|
|
@@ -2378,21 +2380,22 @@ function T({
|
|
|
2378
2380
|
const w = W.createElement("div");
|
|
2379
2381
|
w.className = "map-canvas", this.map = w, this.map.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.mindElixirBox.appendChild(this.container), this.nodes = W.createElement("me-nodes"), this.nodes.className = "main-node-container", this.lines = U("lines"), this.summarySvg = U("summary"), this.linkController = U("linkcontroller"), this.P2 = W.createElement("div"), this.P3 = W.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = ye(), this.line2 = ye(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = U("topiclinks"), this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : st(this);
|
|
2380
2382
|
}
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2383
|
+
L.prototype = ho;
|
|
2384
|
+
L.LEFT = k;
|
|
2385
|
+
L.RIGHT = D;
|
|
2386
|
+
L.SIDE = ie;
|
|
2387
|
+
L.THEME = Oe;
|
|
2388
|
+
L.DARK_THEME = Pe;
|
|
2389
|
+
L.version = po;
|
|
2390
|
+
L.E = N;
|
|
2391
|
+
L.new = (e) => ({
|
|
2390
2392
|
nodeData: {
|
|
2391
2393
|
id: Y(),
|
|
2392
2394
|
topic: e || "new topic",
|
|
2393
2395
|
children: []
|
|
2394
2396
|
}
|
|
2395
2397
|
});
|
|
2398
|
+
L.dragMoveHelper = S;
|
|
2396
2399
|
export {
|
|
2397
|
-
|
|
2400
|
+
L as default
|
|
2398
2401
|
};
|