mind-elixir 3.2.1 → 3.2.2

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.
@@ -203,7 +203,7 @@ function st(t) {
203
203
  D.clear();
204
204
  return;
205
205
  }
206
- t.unselectNode(), t.unselectNodes(), t.unselectSummary();
206
+ t.unselectNode(), t.unselectNodes(), t.unselectSummary(), t.unselectLink();
207
207
  const n = e.target;
208
208
  if (n.tagName === "ME-EPD")
209
209
  t.expandNode(n.previousSibling);
@@ -1334,7 +1334,7 @@ function Rt(t) {
1334
1334
  }
1335
1335
  }
1336
1336
  }).on("beforestart", ({ event: n }) => !(n.button !== 0 || n.target.tagName === "ME-TPC" || n.target.id === "input-box" || n.target.className === "circle")).on("start", ({ event: n }) => {
1337
- !n.ctrlKey && !n.metaKey && (t.unselectNode(), t.unselectNodes(), t.unselectSummary(), e.clearSelection(!0, !0));
1337
+ !n.ctrlKey && !n.metaKey && (t.unselectNode(), t.unselectNodes(), t.unselectSummary(), t.unselectLink(), e.clearSelection(!0, !0));
1338
1338
  }).on(
1339
1339
  "move",
1340
1340
  ({
@@ -1851,8 +1851,10 @@ const Mn = function(t, e, n, i) {
1851
1851
  const e = t.linkObj, n = E(e.from), i = E(e.to), o = ne(this, n, e.delta1), s = ne(this, i, e.delta2);
1852
1852
  this.showLinkController(e, o, s);
1853
1853
  }, An = function() {
1854
+ this.currentLink = null, this.hideLinkController();
1855
+ }, Pn = function() {
1854
1856
  this.linkController.style.display = "none", this.P2.style.display = "none", this.P3.style.display = "none";
1855
- }, Pn = function(t, e, n) {
1857
+ }, jn = function(t, e, n) {
1856
1858
  this.linkController.style.display = "initial", this.P2.style.display = "initial", this.P3.style.display = "initial", this.nodes.appendChild(this.linkController), this.nodes.appendChild(this.P2), this.nodes.appendChild(this.P3);
1857
1859
  let { x: i, y: o } = V(e), { ctrlX: s, ctrlY: r } = e, { ctrlX: l, ctrlY: c } = n, { x: h, y: a } = V(n);
1858
1860
  this.P2.style.cssText = `top:${r}px;left:${s}px;`, this.P3.style.cssText = `top:${c}px;left:${l}px;`, N(this.line1, {
@@ -1897,7 +1899,7 @@ const Mn = function(t, e, n, i) {
1897
1899
  }), t.delta2.x = l - n.cx, t.delta2.y = c - n.cy;
1898
1900
  });
1899
1901
  };
1900
- function jn() {
1902
+ function Hn() {
1901
1903
  this.linkSvgGroup.innerHTML = "";
1902
1904
  for (const t in this.linkData) {
1903
1905
  const e = this.linkData[t];
@@ -1905,7 +1907,7 @@ function jn() {
1905
1907
  }
1906
1908
  this.nodes.appendChild(this.linkSvgGroup);
1907
1909
  }
1908
- function Hn(t) {
1910
+ function Bn(t) {
1909
1911
  if (console.time("editSummary"), !t)
1910
1912
  return;
1911
1913
  const e = t.children[2];
@@ -1915,17 +1917,18 @@ function Hn(t) {
1915
1917
  o === "" ? i.label = origin : i.label = o, n.remove(), o !== origin && (e.innerHTML = i.label, this.linkDiv());
1916
1918
  }), console.timeEnd("editSummary");
1917
1919
  }
1918
- const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1920
+ const zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1919
1921
  __proto__: null,
1920
1922
  createLink: $n,
1921
1923
  drawCustomLink: Tn,
1922
- editCutsomLinkLabel: Hn,
1923
- hideLinkController: An,
1924
+ editCutsomLinkLabel: Bn,
1925
+ hideLinkController: Pn,
1924
1926
  removeLink: Dn,
1925
- renderCustomLink: jn,
1927
+ renderCustomLink: Hn,
1926
1928
  selectLink: On,
1927
- showLinkController: Pn
1928
- }, Symbol.toStringTag, { value: "Module" })), zn = function(t) {
1929
+ showLinkController: jn,
1930
+ unselectLink: An
1931
+ }, Symbol.toStringTag, { value: "Module" })), Rn = function(t) {
1929
1932
  var c, h;
1930
1933
  if (t.length === 0)
1931
1934
  throw new Error("No selected node.");
@@ -1968,7 +1971,7 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1968
1971
  start: s,
1969
1972
  end: r
1970
1973
  };
1971
- }, Rn = function(t) {
1974
+ }, qn = function(t) {
1972
1975
  const e = document.createElementNS("http://www.w3.org/2000/svg", "g");
1973
1976
  return e.setAttribute("id", t), e;
1974
1977
  }, Ce = function(t, e) {
@@ -1988,37 +1991,37 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1988
1991
  y: n + "",
1989
1992
  fill: o || "#666"
1990
1993
  }), s.innerHTML = t, s;
1991
- }, qn = (t) => E(t).parentElement.parentElement, Fn = function({ parent: t, start: e }) {
1994
+ }, Fn = (t) => E(t).parentElement.parentElement, Vn = function({ parent: t, start: e }) {
1992
1995
  var s, r;
1993
1996
  const n = E(t), i = n.nodeObj;
1994
1997
  let o;
1995
1998
  return i.root === !0 ? o = (s = E(i.children[e].id).closest("me-main")) == null ? void 0 : s.className : o = (r = n.closest("me-main")) == null ? void 0 : r.className, o;
1996
1999
  }, We = function(t, e) {
1997
2000
  var _;
1998
- const { id: n, text: i, parent: o, start: s, end: r } = e, l = t.nodes, h = E(o).nodeObj, a = Fn(e);
2001
+ const { id: n, text: i, parent: o, start: s, end: r } = e, l = t.nodes, h = E(o).nodeObj, a = Vn(e);
1999
2002
  let u = 1 / 0, d = 0, p = 0, g = 0;
2000
2003
  for (let Y = s; Y <= r; Y++) {
2001
2004
  const de = (_ = h.children) == null ? void 0 : _[Y];
2002
2005
  if (!de)
2003
2006
  return console.warn("Child not found"), t.removeSummary(n), null;
2004
- const G = qn(de.id), { offsetLeft: J, offsetTop: he } = W(l, G);
2007
+ const G = Fn(de.id), { offsetLeft: J, offsetTop: he } = W(l, G);
2005
2008
  Y === s && (p = he), Y === r && (g = he + G.offsetHeight), J < u && (u = J), G.offsetWidth + J > d && (d = G.offsetWidth + J);
2006
2009
  }
2007
2010
  let m, f;
2008
2011
  const v = p + 10, x = g + 10, b = (v + x) / 2, y = t.theme.cssVar["--color"];
2009
2012
  a === "lhs" ? (m = Ce(`M ${u + 10} ${v} c -5 0 -10 5 -10 10 L ${u} ${x - 10} c 0 5 5 10 10 10 M ${u} ${b} h -10`, y), f = _e(i, u - 20, b + 6, "end", y)) : (m = Ce(`M ${d - 10} ${v} c 5 0 10 5 10 10 L ${d} ${x - 10} c 0 5 -5 10 -10 10 M ${d} ${b} h 10`, y), f = _e(i, d + 20, b + 6, "start", y));
2010
- const C = Rn("s-" + n);
2013
+ const C = qn("s-" + n);
2011
2014
  return C.appendChild(m), C.appendChild(f), C.summaryObj = e, t.summarySvg.appendChild(C), C;
2012
- }, Vn = function() {
2015
+ }, Wn = function() {
2013
2016
  let t = [];
2014
2017
  this.currentNode ? t = [this.currentNode] : this.currentNodes && (t = this.currentNodes);
2015
- const { parent: e, start: n, end: i } = zn(t), o = { id: U(), parent: e, start: n, end: i, text: "summary" }, s = We(this, o);
2018
+ const { parent: e, start: n, end: i } = Rn(t), o = { id: U(), parent: e, start: n, end: i, text: "summary" }, s = We(this, o);
2016
2019
  this.summaries.push(o), this.editSummary(s);
2017
- }, Wn = function(t) {
2020
+ }, Yn = function(t) {
2018
2021
  var n;
2019
2022
  const e = this.summaries.findIndex((i) => i.id === t);
2020
2023
  e > -1 && (this.summaries.splice(e, 1), (n = document.querySelector("#s-" + t)) == null || n.remove());
2021
- }, Yn = function(t) {
2024
+ }, In = function(t) {
2022
2025
  const e = t.children[1].getBBox(), n = 6, i = 3, o = document.createElementNS("http://www.w3.org/2000/svg", "rect");
2023
2026
  N(o, {
2024
2027
  x: e.x - n + "",
@@ -2030,14 +2033,14 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2030
2033
  "stroke-width": "2",
2031
2034
  fill: "none"
2032
2035
  }), o.classList.add("selected"), t.appendChild(o), this.currentSummary = t;
2033
- }, In = function() {
2036
+ }, Xn = function() {
2034
2037
  var t, e;
2035
2038
  (e = (t = this.currentSummary) == null ? void 0 : t.querySelector("rect")) == null || e.remove(), this.currentSummary = null;
2036
- }, Xn = function() {
2039
+ }, Kn = function() {
2037
2040
  this.summarySvg.innerHTML = "", this.summaries.forEach((t) => {
2038
2041
  We(this, t);
2039
2042
  }), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
2040
- }, Kn = function(t) {
2043
+ }, Un = function(t) {
2041
2044
  if (console.time("editSummary"), !t)
2042
2045
  return;
2043
2046
  const e = t.childNodes[1];
@@ -2050,16 +2053,16 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2050
2053
  origin
2051
2054
  }));
2052
2055
  }), console.timeEnd("editSummary");
2053
- }, Un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2056
+ }, Gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2054
2057
  __proto__: null,
2055
- createSummary: Vn,
2056
- editSummary: Kn,
2057
- removeSummary: Wn,
2058
- renderSummary: Xn,
2059
- selectSummary: Yn,
2060
- unselectSummary: In
2058
+ createSummary: Wn,
2059
+ editSummary: Un,
2060
+ removeSummary: Yn,
2061
+ renderSummary: Kn,
2062
+ selectSummary: In,
2063
+ unselectSummary: Xn
2061
2064
  }, Symbol.toStringTag, { value: "Module" }));
2062
- function Gn(t, e) {
2065
+ function Jn(t, e) {
2063
2066
  const n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2064
2067
  return N(n, {
2065
2068
  version: "1.1",
@@ -2068,17 +2071,17 @@ function Gn(t, e) {
2068
2071
  width: e
2069
2072
  }), n;
2070
2073
  }
2071
- function Jn(t, e) {
2074
+ function Qn(t, e) {
2072
2075
  return (parseInt(t) - parseInt(e)) / 2;
2073
2076
  }
2074
- function Qn(t, e, n, i) {
2077
+ function Zn(t, e, n, i) {
2075
2078
  const o = document.createElementNS("http://www.w3.org/2000/svg", "g");
2076
2079
  return t.childNodes[0].textContent.split(`
2077
2080
  `).forEach((l, c) => {
2078
2081
  const h = document.createElementNS("http://www.w3.org/2000/svg", "text");
2079
2082
  N(h, {
2080
2083
  x: n + parseInt(e.paddingLeft) + "",
2081
- y: i + parseInt(e.paddingTop) + Jn(e.lineHeight, e.fontSize) * (c + 1) + parseFloat(e.fontSize) * (c + 1) + "",
2084
+ y: i + parseInt(e.paddingTop) + Qn(e.lineHeight, e.fontSize) * (c + 1) + parseFloat(e.fontSize) * (c + 1) + "",
2082
2085
  "text-anchor": "start",
2083
2086
  "font-family": e.fontFamily,
2084
2087
  "font-size": `${e.fontSize}`,
@@ -2087,7 +2090,7 @@ function Qn(t, e, n, i) {
2087
2090
  }), h.innerHTML = l, o.appendChild(h);
2088
2091
  }), o;
2089
2092
  }
2090
- function Zn(t, e, n, i) {
2093
+ function ei(t, e, n, i) {
2091
2094
  const o = t.childNodes[0].textContent, s = document.createElementNS("http://www.w3.org/2000/svg", "foreignObject");
2092
2095
  N(s, {
2093
2096
  x: n + parseInt(e.paddingLeft) + "",
@@ -2117,9 +2120,9 @@ function re(t, e, n = !1) {
2117
2120
  const l = document.createElementNS("http://www.w3.org/2000/svg", "g");
2118
2121
  l.appendChild(r);
2119
2122
  let c;
2120
- return n ? c = Zn(e, i, o, s) : c = Qn(e, i, o, s), l.appendChild(c), l;
2123
+ return n ? c = ei(e, i, o, s) : c = Zn(e, i, o, s), l.appendChild(c), l;
2121
2124
  }
2122
- function ei(t, e) {
2125
+ function ti(t, e) {
2123
2126
  const n = getComputedStyle(e), { offsetLeft: i, offsetTop: o } = W(t.nodes, e), s = document.createElementNS("http://www.w3.org/2000/svg", "a"), r = document.createElementNS("http://www.w3.org/2000/svg", "text");
2124
2127
  return N(r, {
2125
2128
  x: i + "",
@@ -2131,9 +2134,9 @@ function ei(t, e) {
2131
2134
  fill: `${n.color}`
2132
2135
  }), r.innerHTML = e.textContent, s.appendChild(r), s.setAttribute("href", e.href), s;
2133
2136
  }
2134
- const Z = 100, ti = '<?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">', Ye = (t) => {
2137
+ const Z = 100, ni = '<?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">', Ye = (t) => {
2135
2138
  var a, u, d;
2136
- const e = t.nodes, n = e.offsetHeight + Z * 2, i = e.offsetWidth + Z * 2, o = Gn(n + "px", i + "px"), s = document.createElementNS("http://www.w3.org/2000/svg", "svg"), r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
2139
+ const e = t.nodes, n = e.offsetHeight + Z * 2, i = e.offsetWidth + Z * 2, o = Jn(n + "px", i + "px"), s = document.createElementNS("http://www.w3.org/2000/svg", "svg"), r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
2137
2140
  N(r, {
2138
2141
  x: "0",
2139
2142
  y: "0",
@@ -2156,14 +2159,14 @@ const Z = 100, ti = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "
2156
2159
  }), e.querySelectorAll(".icons > span").forEach((p) => {
2157
2160
  s.appendChild(re(t, p));
2158
2161
  }), e.querySelectorAll(".hyper-link").forEach((p) => {
2159
- s.appendChild(ei(t, p));
2162
+ s.appendChild(ti(t, p));
2160
2163
  }), N(s, {
2161
2164
  x: Z + "",
2162
2165
  y: Z + "",
2163
2166
  overflow: "visible"
2164
- }), o.appendChild(s), ti + o.outerHTML;
2167
+ }), o.appendChild(s), ni + o.outerHTML;
2165
2168
  };
2166
- function ni(t) {
2169
+ function ii(t) {
2167
2170
  return new Promise((e, n) => {
2168
2171
  const i = new FileReader();
2169
2172
  i.onload = (o) => {
@@ -2173,11 +2176,11 @@ function ni(t) {
2173
2176
  }, i.readAsDataURL(t);
2174
2177
  });
2175
2178
  }
2176
- const ii = function() {
2179
+ const oi = function() {
2177
2180
  const t = Ye(this);
2178
2181
  return new Blob([t], { type: "image/svg+xml" });
2179
- }, oi = async function() {
2180
- const t = Ye(this), e = new Blob([t], { type: "image/svg+xml" }), n = await ni(e);
2182
+ }, si = async function() {
2183
+ const t = Ye(this), e = new Blob([t], { type: "image/svg+xml" }), n = await ii(e);
2181
2184
  return new Promise((i, o) => {
2182
2185
  const s = new Image();
2183
2186
  s.setAttribute("crossOrigin", "anonymous"), s.onload = () => {
@@ -2185,12 +2188,12 @@ const ii = function() {
2185
2188
  r.width = s.width, r.height = s.height, r.getContext("2d").drawImage(s, 0, 0), r.toBlob(i, "image/png", 1);
2186
2189
  }, s.src = n, s.onerror = o;
2187
2190
  });
2188
- }, si = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2191
+ }, ri = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2189
2192
  __proto__: null,
2190
- exportPng: oi,
2191
- exportSvg: ii
2193
+ exportPng: si,
2194
+ exportSvg: oi
2192
2195
  }, Symbol.toStringTag, { value: "Module" }));
2193
- function ri(t, e) {
2196
+ function li(t, e) {
2194
2197
  return async function(...n) {
2195
2198
  const i = this.before[e];
2196
2199
  i && !await i.apply(this, n) || t.apply(this, n);
@@ -2199,9 +2202,9 @@ function ri(t, e) {
2199
2202
  const ke = Object.keys(Ve), Ie = {};
2200
2203
  for (let t = 0; t < ke.length; t++) {
2201
2204
  const e = ke[t];
2202
- Ie[e] = ri(Ve[e], e);
2205
+ Ie[e] = li(Ve[e], e);
2203
2206
  }
2204
- const li = {
2207
+ const ci = {
2205
2208
  getObjById: Me,
2206
2209
  generateNewObj: Ue,
2207
2210
  layout: lt,
@@ -2215,9 +2218,9 @@ const li = {
2215
2218
  changeTheme: qt,
2216
2219
  ...fn,
2217
2220
  ...Ie,
2218
- ...Bn,
2219
- ...Un,
2220
- ...si,
2221
+ ...zn,
2222
+ ...Gn,
2223
+ ...ri,
2221
2224
  init(t) {
2222
2225
  if (!t || !t.nodeData)
2223
2226
  return new Error("MindElixir: `data` is required");
@@ -2254,13 +2257,13 @@ function $({
2254
2257
  const y = I.createElement("div");
2255
2258
  y.className = "map-canvas", this.map = y, this.map.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.mindElixirBox.appendChild(this.container), this.nodes = I.createElement("me-nodes"), this.nodes.className = "main-node-container", this.lines = X("lines"), this.summarySvg = X("summary"), this.linkController = X("linkcontroller"), this.P2 = I.createElement("div"), this.P3 = I.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = fe(), this.line2 = fe(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = X("topiclinks"), this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : st(this);
2256
2259
  }
2257
- $.prototype = li;
2260
+ $.prototype = ci;
2258
2261
  $.LEFT = S;
2259
2262
  $.RIGHT = H;
2260
2263
  $.SIDE = K;
2261
2264
  $.THEME = Se;
2262
2265
  $.DARK_THEME = Le;
2263
- $.version = "3.2.1";
2266
+ $.version = "3.2.2";
2264
2267
  $.E = E;
2265
2268
  $.new = (t) => ({
2266
2269
  nodeData: {