mind-elixir 5.2.0 → 5.2.1

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 DjZhou
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2019 DjZhou
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1 +1 @@
1
- var LayoutSsr=function(p){"use strict";var T=(s=>(s.LHS="lhs",s.RHS="rhs",s))(T||{});const v=s=>`<div class="map-container"><div>${s}</div></div>`,j=function(s,c={}){const{direction:a=2}=c,o=e=>{const r={id:e.id,topic:e.topic,direction:e.direction,style:e.style,tags:e.tags,icons:e.icons,hyperLink:e.hyperLink,expanded:e.expanded,image:e.image,branchColor:e.branchColor,dangerouslySetInnerHTML:e.dangerouslySetInnerHTML,note:e.note};return e.children&&e.children.length>0&&(r.children=e.children.map(o)),r},u=o(s),g=s.children||[],m=[],f=[];if(a===2){let e=0,r=0;g.forEach(t=>{const l=o(t);t.direction===0?(l.direction=0,m.push(l),e+=1):t.direction===1?(l.direction=1,f.push(l),r+=1):e<=r?(l.direction=0,m.push(l),e+=1):(l.direction=1,f.push(l),r+=1)})}else a===0?g.forEach(e=>{const r=o(e);r.direction=0,m.push(r)}):g.forEach(e=>{const r=o(e);r.direction=1,f.push(r)});return{root:u,leftNodes:m,rightNodes:f,direction:a}},R=function(s,c={}){const{className:a=""}=c,o=(t,l=!1)=>{const W=`me${t.id}`,w="me-tpc";let L="";if(t.style){const n=[];t.style.color&&n.push(`color: ${t.style.color}`),t.style.background&&n.push(`background: ${t.style.background}`),t.style.fontSize&&n.push(`font-size: ${t.style.fontSize}px`),t.style.fontWeight&&n.push(`font-weight: ${t.style.fontWeight}`),n.length>0&&(L=` style="${n.join("; ")}"`)}let h="";if(t.dangerouslySetInnerHTML)h=t.dangerouslySetInnerHTML;else{if(h=$(t.topic),t.tags&&t.tags.length>0){const n=t.tags.map(i=>{if(typeof i=="string")return`<span class="me-tag">${$(i)}</span>`;{let y="me-tag";i.className&&(y+=` ${i.className}`);let S="";if(i.style){const H=Object.entries(i.style).filter(([I,d])=>d!=null&&d!=="").map(([I,d])=>`${I.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${d}`);H.length>0&&(S=` style="${H.join("; ")}"`)}return`<span class="${y}"${S}>${$(i.text)}</span>`}}).join("");h+=n}if(t.icons&&t.icons.length>0){const n=t.icons.map(i=>`<span class="me-icon">${i}</span>`).join("");h+=n}if(t.image){const{url:n,width:i,height:y,fit:S="cover"}=t.image,H=c.imageProxy?c.imageProxy(n):n;h+=`<img src="${$(H)}" width="${i}" height="${y}" style="object-fit: ${S}" alt="" />`}}const N=`<me-tpc class="${w}" data-nodeid="${W}"${L}>${h}</me-tpc>`;if(l)return`<me-root>${N}</me-root>`;let E="";return t.children&&t.children.length>0&&t.expanded!==!1&&(E=`<me-children>${t.children.map(i=>u(i)).join("")}</me-children>`),`<me-wrapper>${`<me-parent>${N}</me-parent>`}${E}</me-wrapper>`},u=t=>o(t,!1),g=o(s.root,!0),m=s.leftNodes.map(t=>u(t)).join(""),f=s.rightNodes.map(t=>u(t)).join(""),e=`<me-main class="${T.LHS}">${m}</me-main>`,r=`<me-main class="${T.RHS}">${f}</me-main>`;return v(`<div class="${a}">${e}${g}${r}</div>`)};function $(s){const c=typeof document<"u"?document.createElement("div"):null;return c?(c.textContent=s,c.innerHTML):s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}const b=function(s){return JSON.stringify(s,null,2)},M=function(s,c,a={}){return{nodeData:s,layoutResult:c,options:{direction:c.direction,...a},timestamp:Date.now()}};return p.getHydrationData=M,p.getSSRData=b,p.layoutSSR=j,p.renderSSRHTML=R,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),p}({});
1
+ var LayoutSsr=function(p){"use strict";const T={LHS:"lhs",RHS:"rhs"},v=s=>`<div class="map-container"><div>${s}</div></div>`,j=function(s,c={}){const{direction:a=2}=c,o=e=>{const r={id:e.id,topic:e.topic,direction:e.direction,style:e.style,tags:e.tags,icons:e.icons,hyperLink:e.hyperLink,expanded:e.expanded,image:e.image,branchColor:e.branchColor,dangerouslySetInnerHTML:e.dangerouslySetInnerHTML,note:e.note};return e.children&&e.children.length>0&&(r.children=e.children.map(o)),r},u=o(s),g=s.children||[],m=[],f=[];if(a===2){let e=0,r=0;g.forEach(t=>{const l=o(t);t.direction===0?(l.direction=0,m.push(l),e+=1):t.direction===1?(l.direction=1,f.push(l),r+=1):e<=r?(l.direction=0,m.push(l),e+=1):(l.direction=1,f.push(l),r+=1)})}else a===0?g.forEach(e=>{const r=o(e);r.direction=0,m.push(r)}):g.forEach(e=>{const r=o(e);r.direction=1,f.push(r)});return{root:u,leftNodes:m,rightNodes:f,direction:a}},R=function(s,c={}){const{className:a=""}=c,o=(t,l=!1)=>{const M=`me${t.id}`,W="me-tpc";let L="";if(t.style){const n=[];t.style.color&&n.push(`color: ${t.style.color}`),t.style.background&&n.push(`background: ${t.style.background}`),t.style.fontSize&&n.push(`font-size: ${t.style.fontSize}px`),t.style.fontWeight&&n.push(`font-weight: ${t.style.fontWeight}`),n.length>0&&(L=` style="${n.join("; ")}"`)}let h="";if(t.dangerouslySetInnerHTML)h=t.dangerouslySetInnerHTML;else{if(h=$(t.topic),t.tags&&t.tags.length>0){const n=t.tags.map(i=>{if(typeof i=="string")return`<span class="me-tag">${$(i)}</span>`;{let y="me-tag";i.className&&(y+=` ${i.className}`);let S="";if(i.style){const H=Object.entries(i.style).filter(([I,d])=>d!=null&&d!=="").map(([I,d])=>`${I.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${d}`);H.length>0&&(S=` style="${H.join("; ")}"`)}return`<span class="${y}"${S}>${$(i.text)}</span>`}}).join("");h+=n}if(t.icons&&t.icons.length>0){const n=t.icons.map(i=>`<span class="me-icon">${i}</span>`).join("");h+=n}if(t.image){const{url:n,width:i,height:y,fit:S="cover"}=t.image,H=c.imageProxy?c.imageProxy(n):n;h+=`<img src="${$(H)}" width="${i}" height="${y}" style="object-fit: ${S}" alt="" />`}}const N=`<me-tpc class="${W}" data-nodeid="${M}"${L}>${h}</me-tpc>`;if(l)return`<me-root>${N}</me-root>`;let E="";return t.children&&t.children.length>0&&t.expanded!==!1&&(E=`<me-children>${t.children.map(i=>u(i)).join("")}</me-children>`),`<me-wrapper>${`<me-parent>${N}</me-parent>`}${E}</me-wrapper>`},u=t=>o(t,!1),g=o(s.root,!0),m=s.leftNodes.map(t=>u(t)).join(""),f=s.rightNodes.map(t=>u(t)).join(""),e=`<me-main class="${T.LHS}">${m}</me-main>`,r=`<me-main class="${T.RHS}">${f}</me-main>`;return v(`<div class="${a}">${e}${g}${r}</div>`)};function $(s){const c=typeof document<"u"?document.createElement("div"):null;return c?(c.textContent=s,c.innerHTML):s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}const b=function(s){return JSON.stringify(s,null,2)},D=function(s,c,a={}){return{nodeData:s,layoutResult:c,options:{direction:c.direction,...a},timestamp:Date.now()}};return p.getHydrationData=D,p.getSSRData=b,p.layoutSSR=j,p.renderSSRHTML=R,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),p}({});
package/dist/LayoutSsr.js CHANGED
@@ -1,6 +1,8 @@
1
- var S = /* @__PURE__ */ ((s) => (s.LHS = "lhs", s.RHS = "rhs", s))(S || {});
2
- const j = (s) => `<div class="map-container"><div>${s}</div></div>`, b = function(s, c = {}) {
3
- const { direction: a = 2 } = c, o = (e) => {
1
+ const E = {
2
+ LHS: "lhs",
3
+ RHS: "rhs"
4
+ }, v = (s) => `<div class="map-container"><div>${s}</div></div>`, b = function(s, c = {}) {
5
+ const { direction: a = 2 } = c, l = (e) => {
4
6
  const r = {
5
7
  id: e.id,
6
8
  topic: e.topic,
@@ -15,20 +17,20 @@ const j = (s) => `<div class="map-container"><div>${s}</div></div>`, b = functio
15
17
  dangerouslySetInnerHTML: e.dangerouslySetInnerHTML,
16
18
  note: e.note
17
19
  };
18
- return e.children && e.children.length > 0 && (r.children = e.children.map(o)), r;
19
- }, h = o(s), g = s.children || [], p = [], m = [];
20
+ return e.children && e.children.length > 0 && (r.children = e.children.map(l)), r;
21
+ }, h = l(s), g = s.children || [], p = [], m = [];
20
22
  if (a === 2) {
21
23
  let e = 0, r = 0;
22
24
  g.forEach((t) => {
23
- const l = o(t);
24
- t.direction === 0 ? (l.direction = 0, p.push(l), e += 1) : t.direction === 1 ? (l.direction = 1, m.push(l), r += 1) : e <= r ? (l.direction = 0, p.push(l), e += 1) : (l.direction = 1, m.push(l), r += 1);
25
+ const o = l(t);
26
+ t.direction === 0 ? (o.direction = 0, p.push(o), e += 1) : t.direction === 1 ? (o.direction = 1, m.push(o), r += 1) : e <= r ? (o.direction = 0, p.push(o), e += 1) : (o.direction = 1, m.push(o), r += 1);
25
27
  });
26
28
  } else
27
29
  a === 0 ? g.forEach((e) => {
28
- const r = o(e);
30
+ const r = l(e);
29
31
  r.direction = 0, p.push(r);
30
32
  }) : g.forEach((e) => {
31
- const r = o(e);
33
+ const r = l(e);
32
34
  r.direction = 1, m.push(r);
33
35
  });
34
36
  return {
@@ -38,12 +40,12 @@ const j = (s) => `<div class="map-container"><div>${s}</div></div>`, b = functio
38
40
  direction: a
39
41
  };
40
42
  }, w = function(s, c = {}) {
41
- const { className: a = "" } = c, o = (t, l = !1) => {
42
- const I = `me${t.id}`, v = "me-tpc";
43
- let T = "";
43
+ const { className: a = "" } = c, l = (t, o = !1) => {
44
+ const I = `me${t.id}`, j = "me-tpc";
45
+ let S = "";
44
46
  if (t.style) {
45
47
  const n = [];
46
- t.style.color && n.push(`color: ${t.style.color}`), t.style.background && n.push(`background: ${t.style.background}`), t.style.fontSize && n.push(`font-size: ${t.style.fontSize}px`), t.style.fontWeight && n.push(`font-weight: ${t.style.fontWeight}`), n.length > 0 && (T = ` style="${n.join("; ")}"`);
48
+ t.style.color && n.push(`color: ${t.style.color}`), t.style.background && n.push(`background: ${t.style.background}`), t.style.fontSize && n.push(`font-size: ${t.style.fontSize}px`), t.style.fontWeight && n.push(`font-weight: ${t.style.fontWeight}`), n.length > 0 && (S = ` style="${n.join("; ")}"`);
47
49
  }
48
50
  let f = "";
49
51
  if (t.dangerouslySetInnerHTML)
@@ -58,7 +60,7 @@ const j = (s) => `<div class="map-container"><div>${s}</div></div>`, b = functio
58
60
  i.className && (d += ` ${i.className}`);
59
61
  let $ = "";
60
62
  if (i.style) {
61
- const y = Object.entries(i.style).filter(([E, u]) => u != null && u !== "").map(([E, u]) => `${E.replace(/([A-Z])/g, "-$1").toLowerCase()}: ${u}`);
63
+ const y = Object.entries(i.style).filter(([N, u]) => u != null && u !== "").map(([N, u]) => `${N.replace(/([A-Z])/g, "-$1").toLowerCase()}: ${u}`);
62
64
  y.length > 0 && ($ = ` style="${y.join("; ")}"`);
63
65
  }
64
66
  return `<span class="${d}"${$}>${H(i.text)}</span>`;
@@ -75,21 +77,21 @@ const j = (s) => `<div class="map-container"><div>${s}</div></div>`, b = functio
75
77
  f += `<img src="${H(y)}" width="${i}" height="${d}" style="object-fit: ${$}" alt="" />`;
76
78
  }
77
79
  }
78
- const L = `<me-tpc class="${v}" data-nodeid="${I}"${T}>${f}</me-tpc>`;
79
- if (l)
80
- return `<me-root>${L}</me-root>`;
81
- let N = "";
82
- return t.children && t.children.length > 0 && t.expanded !== !1 && (N = `<me-children>${t.children.map((i) => h(i)).join("")}</me-children>`), `<me-wrapper>${`<me-parent>${L}</me-parent>`}${N}</me-wrapper>`;
83
- }, h = (t) => o(t, !1), g = o(s.root, !0), p = s.leftNodes.map((t) => h(t)).join(""), m = s.rightNodes.map((t) => h(t)).join(""), e = `<me-main class="${S.LHS}">${p}</me-main>`, r = `<me-main class="${S.RHS}">${m}</me-main>`;
84
- return j(`<div class="${a}">${e}${g}${r}</div>`);
80
+ const T = `<me-tpc class="${j}" data-nodeid="${I}"${S}>${f}</me-tpc>`;
81
+ if (o)
82
+ return `<me-root>${T}</me-root>`;
83
+ let L = "";
84
+ return t.children && t.children.length > 0 && t.expanded !== !1 && (L = `<me-children>${t.children.map((i) => h(i)).join("")}</me-children>`), `<me-wrapper>${`<me-parent>${T}</me-parent>`}${L}</me-wrapper>`;
85
+ }, h = (t) => l(t, !1), g = l(s.root, !0), p = s.leftNodes.map((t) => h(t)).join(""), m = s.rightNodes.map((t) => h(t)).join(""), e = `<me-main class="${E.LHS}">${p}</me-main>`, r = `<me-main class="${E.RHS}">${m}</me-main>`;
86
+ return v(`<div class="${a}">${e}${g}${r}</div>`);
85
87
  };
86
88
  function H(s) {
87
89
  const c = typeof document < "u" ? document.createElement("div") : null;
88
90
  return c ? (c.textContent = s, c.innerHTML) : s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
89
91
  }
90
- const R = function(s) {
92
+ const C = function(s) {
91
93
  return JSON.stringify(s, null, 2);
92
- }, F = function(s, c, a = {}) {
94
+ }, R = function(s, c, a = {}) {
93
95
  return {
94
96
  nodeData: s,
95
97
  layoutResult: c,
@@ -101,8 +103,8 @@ const R = function(s) {
101
103
  };
102
104
  };
103
105
  export {
104
- F as getHydrationData,
105
- R as getSSRData,
106
+ R as getHydrationData,
107
+ C as getSSRData,
106
108
  b as layoutSSR,
107
109
  w as renderSSRHTML
108
110
  };