New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

markmap-lib

Package Overview
Dependencies
Maintainers
1
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markmap-lib - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

17

dist/browser/view.js

@@ -1,2 +0,2 @@

/*! markmap-lib v0.7.0 | MIT License */
/*! markmap-lib v0.7.1 | MIT License */
(function (exports, d3) {

@@ -666,2 +666,5 @@ 'use strict';

}, mathJax.options);
mathJax.startup = Object.assign({
typeset: false
}, mathJax.startup);
window.MathJax = mathJax;

@@ -844,2 +847,8 @@ },

updateStyle();
svg.call(zoom);
const mm = {
setData,
setOptions,
fit
};

@@ -851,8 +860,2 @@ if (data) {

svg.call(zoom);
const mm = {
setData,
setOptions,
fit
};
return mm;

@@ -859,0 +862,0 @@

@@ -1,2 +0,2 @@

/*! markmap-lib v0.7.0 | MIT License */
!function(t,e){"use strict";function n(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function r(t,e){var n,r,a,c,l,h=new s(t),d=+t.value&&(h.value=t.value),u=[h];for(null==e&&(e=i);n=u.pop();)if(d&&(n.value=+n.data.value),(a=e(n.data))&&(l=a.length))for(n.children=new Array(l),c=l-1;c>=0;--c)u.push(r=n.children[c]=new s(a[c])),r.parent=n,r.depth=n.depth+1;return h.eachBefore(o)}function i(t){return t.children}function a(t){t.data=t.data.data}function o(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function s(t){this.data=t,this.depth=this.height=0,this.parent=null}s.prototype=r.prototype={constructor:s,count:function(){return this.eachAfter(n)},each:function(t){var e,n,r,i,a=this,o=[a];do{for(e=o.reverse(),o=[];a=e.pop();)if(t(a),n=a.children)for(r=0,i=n.length;r<i;++r)o.push(n[r])}while(o.length);return this},eachAfter:function(t){for(var e,n,r,i=this,a=[i],o=[];i=a.pop();)if(o.push(i),e=i.children)for(n=0,r=e.length;n<r;++n)a.push(e[n]);for(;i=o.pop();)t(i);return this},eachBefore:function(t){for(var e,n,r=this,i=[r];r=i.pop();)if(t(r),e=r.children)for(n=e.length-1;n>=0;--n)i.push(e[n]);return this},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;t=n.pop(),e=r.pop();for(;t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each((function(e){t.push(e)})),t},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return r(this).eachBefore(a)}};const c=Object.freeze({children:t=>t.children,nodeSize:t=>t.data.size,spacing:0});function l(t){const e=Object.assign({},c,t);function n(t){const n=e[t];return"function"==typeof n?n:()=>n}function i(t){const e=o(function(){const t=a(),e=n("nodeSize"),r=n("spacing");return class extends t{constructor(t){super(t),Object.assign(this,{x:0,y:0,relX:0,prelim:0,shift:0,change:0,lExt:this,lExtRelX:0,lThr:null,rExt:this,rExtRelX:0,rThr:null})}get size(){return e(this.data)}spacing(t){return r(this.data,t.data)}get x(){return this.data.x}set x(t){this.data.x=t}get y(){return this.data.y}set y(t){this.data.y=t}update(){return h(this),d(this),this}}}(),t,t=>t.children);return e.update(),e.data}function a(){const t=n("nodeSize"),e=n("spacing");return class n extends r.prototype.constructor{constructor(t){super(t)}copy(){const t=o(this.constructor,this,t=>t.children);return t.each(t=>t.data=t.data.data),t}get size(){return t(this)}spacing(t){return e(this,t)}get nodes(){return this.descendants()}get xSize(){return this.size[0]}get ySize(){return this.size[1]}get top(){return this.y}get bottom(){return this.y+this.ySize}get left(){return this.x-this.xSize/2}get right(){return this.x+this.xSize/2}get root(){const t=this.ancestors();return t[t.length-1]}get numChildren(){return this.hasChildren?this.children.length:0}get hasChildren(){return!this.noChildren}get noChildren(){return null===this.children}get firstChild(){return this.hasChildren?this.children[0]:null}get lastChild(){return this.hasChildren?this.children[this.numChildren-1]:null}get extents(){return(this.children||[]).reduce((t,e)=>n.maxExtents(t,e.extents),this.nodeExtents)}get nodeExtents(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}static maxExtents(t,e){return{top:Math.min(t.top,e.top),bottom:Math.max(t.bottom,e.bottom),left:Math.min(t.left,e.left),right:Math.max(t.right,e.right)}}}}function o(t,e,n){const r=(e,i)=>{const a=new t(e);Object.assign(a,{parent:i,depth:null===i?0:i.depth+1,height:0,length:1});const o=n(e)||[];return a.children=0===o.length?null:o.map(t=>r(t,a)),a.children&&Object.assign(a,a.children.reduce((t,e)=>({height:Math.max(t.height,e.height+1),length:t.length+e.length}),a)),a};return r(e,null)}return Object.assign(i,{nodeSize(t){return arguments.length?(e.nodeSize=t,i):e.nodeSize},spacing(t){return arguments.length?(e.spacing=t,i):e.spacing},children(t){return arguments.length?(e.children=t,i):e.children},hierarchy(t,n){const r=void 0===n?e.children:n;return o(a(),t,r)},dump(t){const e=n("nodeSize"),r=t=>n=>{const i=t+" ",a=t+" ",{x:o,y:s}=n,c=e(n),l=n.children||[],h=0===l.length?" ":`,${i}children: [${a}${l.map(r(a)).join(a)}${i}],${t}`;return`{ size: [${c.join(", ")}],${i}x: ${o}, y: ${s}${h}},`};return r("\n")(t)}}),i}l.version="2.1.1";const h=(t,e=0)=>(t.y=e,(t.children||[]).reduce((e,n)=>{const[r,i]=e;h(n,t.y+t.ySize);const a=(0===r?n.lExt:n.rExt).bottom;return 0!==r&&p(t,r,i),[r+1,S(a,r,i)]},[0,null]),u(t),z(t),t),d=(t,e,n)=>{void 0===e&&(e=-t.relX-t.prelim,n=0);const r=e+t.relX;return t.relX=r+t.prelim-n,t.prelim=0,t.x=n+t.relX,(t.children||[]).forEach(e=>d(e,r,t.x)),t},u=t=>{(t.children||[]).reduce((t,e)=>{const[n,r]=t,i=n+e.shift,a=r+i+e.change;return e.relX+=a,[i,a]},[0,0])},p=(t,e,n)=>{const r=t.children[e-1],i=t.children[e];let a=r,o=r.relX,s=i,c=i.relX,l=!0;for(;a&&s;){a.bottom>n.lowY&&(n=n.next);const r=o+a.prelim-(c+s.prelim)+a.xSize/2+s.xSize/2+a.spacing(s);(r>0||r<0&&l)&&(c+=r,f(i,r),g(t,e,n.index,r)),l=!1;const h=a.bottom,d=s.bottom;h<=d&&(a=x(a),a&&(o+=a.relX)),h>=d&&(s=m(s),s&&(c+=s.relX))}!a&&s?y(t,e,s,c):a&&!s&&v(t,e,a,o)},f=(t,e)=>{t.relX+=e,t.lExtRelX+=e,t.rExtRelX+=e},g=(t,e,n,r)=>{const i=t.children[e],a=e-n;if(a>1){const e=r/a;t.children[n+1].shift+=e,i.shift-=e,i.change-=r-e}},m=t=>t.hasChildren?t.firstChild:t.lThr,x=t=>t.hasChildren?t.lastChild:t.rThr,y=(t,e,n,r)=>{const i=t.firstChild,a=i.lExt,o=t.children[e];a.lThr=n;const s=r-n.relX-i.lExtRelX;a.relX+=s,a.prelim-=s,i.lExt=o.lExt,i.lExtRelX=o.lExtRelX},v=(t,e,n,r)=>{const i=t.children[e],a=i.rExt,o=t.children[e-1];a.rThr=n;const s=r-n.relX-i.rExtRelX;a.relX+=s,a.prelim-=s,i.rExt=o.rExt,i.rExtRelX=o.rExtRelX},z=t=>{if(t.hasChildren){const e=t.firstChild,n=t.lastChild,r=(e.prelim+e.relX-e.xSize/2+n.relX+n.prelim+n.xSize/2)/2;Object.assign(t,{prelim:r,lExt:e.lExt,lExtRelX:e.lExtRelX,rExt:n.rExt,rExtRelX:n.rExtRelX})}},S=(t,e,n)=>{for(;null!==n&&t>=n.lowY;)n=n.next;return{lowY:t,index:e,next:n}};function j(t,e,n){const r=document.createElement(t);return e&&Object.entries(e).forEach(([t,e])=>{r[t]=e}),n&&Object.entries(n).forEach(([t,e])=>{r.setAttribute(t,e)}),r}const b=function(t){const e={};return function(...n){const r=`${n[0]}`;let i=e[r];return i||(i={value:t(...n)},e[r]=i),i.value}}(t=>{document.head.append(j("link",{rel:"preload",as:"script",href:t}))});function $(t,e){if("script"===t.type)return new Promise((e,n)=>{document.head.append(j("script",Object.assign(Object.assign({},t.data),{},{onload:e,onerror:n})))});if("iife"===t.type){const{fn:n,getParams:r}=t.data;n(...(null==r?void 0:r(e))||[])}}function E(t){"style"===t.type?document.head.append(j("style",{textContent:t.data})):"stylesheet"===t.type&&document.head.append(j("link",Object.assign({rel:"stylesheet"},t.data)))}async function w(t,e){return e=Object.assign({},e),await Promise.all([t.map(t=>(function(t){for(const e of t)E(e)}(t.styles),async function(t,e){const n=t.filter(t=>"script"===t.type);n.length>1&&n.forEach(t=>b(t.data.src));for(const n of t)await $(n,e)}(t.scripts,e)))]),t.map(({transform:t})=>t)}const X=[{type:"iife",data:{fn:t=>{t.options=Object.assign({skipHtmlTags:{"[-]":["code","pre"]}},t.options),window.MathJax=t},getParams:t=>[Object.assign({},t.mathJax)]}},{type:"script",data:{src:"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"}}];var O=Object.freeze({__proto__:null,styles:[],scripts:X,transform:function(t,e){var n,r;null==(n=(r=window.MathJax).typeset)||n.call(r,t)}});const k=[{type:"iife",data:{fn:()=>{window.Prism={manual:!0}}}},{type:"script",data:{src:"https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-core.min.js"}},{type:"script",data:{src:"https://cdn.jsdelivr.net/npm/prismjs@1/plugins/autoloader/prism-autoloader.min.js"}}];var C=Object.freeze({__proto__:null,styles:[{type:"stylesheet",data:{href:"https://cdn.jsdelivr.net/npm/prismjs@1/themes/prism.css"}}],scripts:k,transform:function(t,e){const{Prism:n}=window,r=t.flatMap(t=>Array.from(t.querySelectorAll("code[class*=language-]"))).map(t=>{const e=t.className.match(/(?:^|\s)language-(\S+)|$/)[1];if(!n.languages[e])return e;n.highlightElement(t)}).filter(Boolean);r.length&&n.plugins.autoloader.loadLanguages(r,()=>{e.setData(),e.fit()})}}),M=Object.freeze({__proto__:null,mathJax:O,prism:C});const R=Math.random().toString(36).slice(2,8);let I=0;function A(t,e,n="c"){const r=(t,i)=>e(t,()=>{var e;null==(e=t[n])||e.forEach(e=>{r(e,t)})},i);r(t)}function _(t){const e=t.data;return Math.max(6-2*e.d,1.5)}function B(t){const e=[];for(let n=0;n<t.length;n+=1)e.push(t[n]);return e}function T(t){if("string"==typeof t){const e=t;t=t=>t.tagName===e}const e=t;return function(){let t=B(this.childNodes);return e&&(t=t.filter(t=>e(t))),t}}function H(t,...e){const n=(t||"").split(" ").filter(Boolean);return e.forEach(t=>{t&&n.indexOf(t)<0&&n.push(t)}),n.join(" ")}const N=Object.assign((function(t,n,r){const i=(t=t.datum?t:e.select(t)).append("style"),a=e.zoom().on("zoom",(function(){const{transform:t}=e.event;h.attr("transform",t)})),o=t.node(),s=Object.assign({duration:500,nodeFont:"300 16px/20px sans-serif",nodeMinHeight:16,spacingVertical:5,spacingHorizontal:80,autoFit:!1,fitRatio:.95,color:e.scaleOrdinal(e.schemeCategory10),colorDepth:0,paddingX:8},r),c={id:s.id||(I+=1,`mm-${R}-${I}`)},h=t.append("g").attr("class",`${c.id}-g`);t.attr("class",H(t.attr("class"),c.id)),void i.text(u()),n&&(f(n),m());t.call(a);const d={setData:f,setOptions:p,fit:m};return d;function u(){const{style:t}=s;return`.${c.id} a { color: #0097e6; }\n.${c.id} a:hover { color: #00a8ff; }\n.${c.id}-g > path { fill: none; }\n.${c.id}-fo > div { font: ${s.nodeFont}; white-space: nowrap; }\n.${c.id}-fo code { padding: .2em .4em; font-size: calc(1em - 2px); color: #555; background-color: #f0f0f0; border-radius: 2px; }\n.${c.id}-fo del { text-decoration: line-through; }\n.${c.id}-fo em { font-style: italic; }\n.${c.id}-fo strong { font-weight: 500; }\n.${c.id}-fo pre { margin: 0; }\n.${c.id}-fo pre[class*=language-] { padding: 0; }\n.${c.id}-g > g { cursor: pointer; }\n${t?t(c.id):""}\n`}function p(t){Object.assign(s,t)}function f(t,e){t||(t=Object.assign({},c.data)),c.data=t,function(t){var e;let n=0,r=0;const{colorDepth:i}=s,a=document.createElement("div"),o=`${c.id}-container`;a.className=H(a.className,`${c.id}-fo`,o);const l=document.createElement("style");if(l.textContent=`\n${u()}\n.${o} {\n position: absolute;\n width: 0;\n height: 0;\n top: -100px;\n left: -100px;\n overflow: hidden;\n font: ${s.nodeFont};\n}\n.${o} > div {\n display: inline-block;\n}\n`,document.body.append(l,a),A(t,(t,e)=>{var o;t.c=null==(o=t.c)?void 0:o.map(t=>Object.assign({},t)),n+=1,s.color(`${r}`);const c=document.createElement("div");c.innerHTML=t.v,a.append(c),t.p=Object.assign(Object.assign({},t.p),{},{i:n,c:r,el:c}),e(),i&&t.d!==i||(r+=1)}),null==(e=N.processors)?void 0:e.length){const t=B(a.childNodes);N.processors.forEach(e=>{e(t,d)})}A(t,(t,e,n)=>{var r;const i=t.p.el.getBoundingClientRect();t.v=t.p.el.innerHTML,t.p.s=[Math.ceil(i.width),Math.max(Math.ceil(i.height),s.nodeMinHeight)],t.p.k=`${(null==n||null==(r=n.p)?void 0:r.i)||""}.${t.p.i}:${t.v}`,e()}),a.remove(),l.remove()}(t),e&&p(e),y()}function g(t){return s.duration?t.transition().duration(s.duration):t}function m(){const{width:n,height:r}=o.getBoundingClientRect(),{minX:i,maxX:l,minY:h,maxY:d}=c,u=d-h,p=l-i,f=Math.min(n/u*s.fitRatio,r/p*s.fitRatio,2),m=e.zoomIdentity.translate((n-u*f)/2-h*f,(r-p*f)/2-i*f).scale(f);g(t).call(a.transform,m)}function x(t){var e;const{data:n}=t;n.p=Object.assign(Object.assign({},n.p),{},{f:!(null==(e=n.p)?void 0:e.f)}),y(t.data)}function y(t){var n,r;if(!c.data)return;const{spacingHorizontal:i}=s,a=l().children(t=>{var e;return!(null==(e=t.p)?void 0:e.f)&&t.c}).nodeSize(t=>{const[e,n]=t.data.p.s;return[n,e+(e?2*s.paddingX:0)+i]}).spacing((t,e)=>t.parent===e.parent?s.spacingVertical:2*s.spacingVertical),o=a.hierarchy(c.data);a(o),function(t,e){A(t,(t,n)=>{t.ySizeInner=t.ySize-e,t.y+=e,n()},"children")}(o,i);const d=o.descendants().reverse(),u=o.links(),p=e.linkHorizontal(),f=e.min(d,t=>t.x-t.xSize/2),y=e.max(d,t=>t.x+t.xSize/2),v=e.min(d,t=>t.y),z=e.max(d,t=>t.y+t.ySizeInner);c.minX=f,c.maxX=y,c.minY=v,c.maxY=z,s.autoFit&&m();const S=t&&d.find(e=>e.data===t)||o,j=null!=(n=S.data.x0)?n:S.x,b=null!=(r=S.data.y0)?r:S.y,$=h.selectAll(T("g")).data(d,t=>t.data.p.k),E=$.enter().append("g").attr("transform",t=>`translate(${b+S.ySizeInner-t.ySizeInner},${j+S.xSize/2-t.xSize})`).on("click",x),w=g($.exit());w.select("rect").attr("width",0).attr("x",t=>t.ySizeInner),w.select("foreignObject").style("opacity",0),w.attr("transform",t=>`translate(${S.y+S.ySizeInner-t.ySizeInner},${S.x+S.xSize/2-t.xSize})`).remove();const X=$.merge(E);g(X).attr("transform",t=>`translate(${t.y},${t.x-t.xSize/2})`),g(X.selectAll(T("rect")).data(t=>[t],t=>t.data.p.k).join(t=>t.append("rect").attr("x",t=>t.ySizeInner).attr("y",t=>t.xSize-_(t)/2).attr("width",0).attr("height",_),t=>t,t=>t.remove())).attr("x",-1).attr("width",t=>t.ySizeInner+2).attr("fill",t=>s.color(t.data.p.c)),g(X.selectAll(T("circle")).data(t=>t.data.c?[t]:[],t=>t.data.p.k).join(t=>t.append("circle").attr("stroke-width","1.5").attr("cx",t=>t.ySizeInner).attr("cy",t=>t.xSize).attr("r",0),t=>t,t=>t.remove())).attr("r",6).attr("stroke",t=>s.color(t.data.p.c)).attr("fill",t=>{var e;return(null==(e=t.data.p)?void 0:e.f)?s.color(t.data.p.c):"#fff"}),g(X.selectAll(T("foreignObject")).data(t=>[t],t=>t.data.p.k).join(t=>{const e=t.append("foreignObject").attr("class",`${c.id}-fo`).attr("x",s.paddingX).attr("y",0).style("opacity",0).attr("height",t=>t.xSize);return e.append("xhtml:div").select((function(t){const e=t.data.p.el.cloneNode(!0);return this.replaceWith(e),e})).attr("xmlns","http://www.w3.org/1999/xhtml"),e},t=>t,t=>t.remove()).attr("width",t=>Math.max(0,t.ySizeInner-2*s.paddingX))).style("opacity",1);const O=h.selectAll(T("path")).data(u,t=>t.target.data.p.k).join(t=>{const e=[b+S.ySizeInner,j+S.xSize/2];return t.insert("path","g").attr("d",p({source:e,target:e}))},t=>t,t=>{const e=[S.y+S.ySizeInner,S.x+S.xSize/2];return g(t).attr("d",p({source:e,target:e})).remove()});g(O).attr("stroke",t=>s.color(t.target.data.p.c)).attr("stroke-width",t=>_(t.target)).attr("d",t=>{const e=[t.source.y+t.source.ySizeInner,t.source.x+t.source.xSize/2],n=[t.target.y,t.target.x+t.target.xSize/2];return p({source:e,target:n})}),d.forEach(t=>{t.data.x0=t.x,t.data.y0=t.y})}}),{processors:[]});t.loadPlugins=async function(t,e){t=t.map(t=>{if("string"==typeof t){const e=t;(t=M[e])||console.warn(`[markmap] Unknown plugin: ${e}`)}return t}).filter(Boolean),N.processors=[...N.processors,...await w(t,e)]},t.markmap=N,t.plugins=M}(this.markmap=this.markmap||{},d3);
/*! markmap-lib v0.7.1 | MIT License */
!function(t,e){"use strict";function n(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function r(t,e){var n,r,a,c,l,h=new o(t),d=+t.value&&(h.value=t.value),u=[h];for(null==e&&(e=i);n=u.pop();)if(d&&(n.value=+n.data.value),(a=e(n.data))&&(l=a.length))for(n.children=new Array(l),c=l-1;c>=0;--c)u.push(r=n.children[c]=new o(a[c])),r.parent=n,r.depth=n.depth+1;return h.eachBefore(s)}function i(t){return t.children}function a(t){t.data=t.data.data}function s(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function o(t){this.data=t,this.depth=this.height=0,this.parent=null}o.prototype=r.prototype={constructor:o,count:function(){return this.eachAfter(n)},each:function(t){var e,n,r,i,a=this,s=[a];do{for(e=s.reverse(),s=[];a=e.pop();)if(t(a),n=a.children)for(r=0,i=n.length;r<i;++r)s.push(n[r])}while(s.length);return this},eachAfter:function(t){for(var e,n,r,i=this,a=[i],s=[];i=a.pop();)if(s.push(i),e=i.children)for(n=0,r=e.length;n<r;++n)a.push(e[n]);for(;i=s.pop();)t(i);return this},eachBefore:function(t){for(var e,n,r=this,i=[r];r=i.pop();)if(t(r),e=r.children)for(n=e.length-1;n>=0;--n)i.push(e[n]);return this},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;t=n.pop(),e=r.pop();for(;t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each((function(e){t.push(e)})),t},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return r(this).eachBefore(a)}};const c=Object.freeze({children:t=>t.children,nodeSize:t=>t.data.size,spacing:0});function l(t){const e=Object.assign({},c,t);function n(t){const n=e[t];return"function"==typeof n?n:()=>n}function i(t){const e=s(function(){const t=a(),e=n("nodeSize"),r=n("spacing");return class extends t{constructor(t){super(t),Object.assign(this,{x:0,y:0,relX:0,prelim:0,shift:0,change:0,lExt:this,lExtRelX:0,lThr:null,rExt:this,rExtRelX:0,rThr:null})}get size(){return e(this.data)}spacing(t){return r(this.data,t.data)}get x(){return this.data.x}set x(t){this.data.x=t}get y(){return this.data.y}set y(t){this.data.y=t}update(){return h(this),d(this),this}}}(),t,t=>t.children);return e.update(),e.data}function a(){const t=n("nodeSize"),e=n("spacing");return class n extends r.prototype.constructor{constructor(t){super(t)}copy(){const t=s(this.constructor,this,t=>t.children);return t.each(t=>t.data=t.data.data),t}get size(){return t(this)}spacing(t){return e(this,t)}get nodes(){return this.descendants()}get xSize(){return this.size[0]}get ySize(){return this.size[1]}get top(){return this.y}get bottom(){return this.y+this.ySize}get left(){return this.x-this.xSize/2}get right(){return this.x+this.xSize/2}get root(){const t=this.ancestors();return t[t.length-1]}get numChildren(){return this.hasChildren?this.children.length:0}get hasChildren(){return!this.noChildren}get noChildren(){return null===this.children}get firstChild(){return this.hasChildren?this.children[0]:null}get lastChild(){return this.hasChildren?this.children[this.numChildren-1]:null}get extents(){return(this.children||[]).reduce((t,e)=>n.maxExtents(t,e.extents),this.nodeExtents)}get nodeExtents(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}static maxExtents(t,e){return{top:Math.min(t.top,e.top),bottom:Math.max(t.bottom,e.bottom),left:Math.min(t.left,e.left),right:Math.max(t.right,e.right)}}}}function s(t,e,n){const r=(e,i)=>{const a=new t(e);Object.assign(a,{parent:i,depth:null===i?0:i.depth+1,height:0,length:1});const s=n(e)||[];return a.children=0===s.length?null:s.map(t=>r(t,a)),a.children&&Object.assign(a,a.children.reduce((t,e)=>({height:Math.max(t.height,e.height+1),length:t.length+e.length}),a)),a};return r(e,null)}return Object.assign(i,{nodeSize(t){return arguments.length?(e.nodeSize=t,i):e.nodeSize},spacing(t){return arguments.length?(e.spacing=t,i):e.spacing},children(t){return arguments.length?(e.children=t,i):e.children},hierarchy(t,n){const r=void 0===n?e.children:n;return s(a(),t,r)},dump(t){const e=n("nodeSize"),r=t=>n=>{const i=t+" ",a=t+" ",{x:s,y:o}=n,c=e(n),l=n.children||[],h=0===l.length?" ":`,${i}children: [${a}${l.map(r(a)).join(a)}${i}],${t}`;return`{ size: [${c.join(", ")}],${i}x: ${s}, y: ${o}${h}},`};return r("\n")(t)}}),i}l.version="2.1.1";const h=(t,e=0)=>(t.y=e,(t.children||[]).reduce((e,n)=>{const[r,i]=e;h(n,t.y+t.ySize);const a=(0===r?n.lExt:n.rExt).bottom;return 0!==r&&p(t,r,i),[r+1,S(a,r,i)]},[0,null]),u(t),z(t),t),d=(t,e,n)=>{void 0===e&&(e=-t.relX-t.prelim,n=0);const r=e+t.relX;return t.relX=r+t.prelim-n,t.prelim=0,t.x=n+t.relX,(t.children||[]).forEach(e=>d(e,r,t.x)),t},u=t=>{(t.children||[]).reduce((t,e)=>{const[n,r]=t,i=n+e.shift,a=r+i+e.change;return e.relX+=a,[i,a]},[0,0])},p=(t,e,n)=>{const r=t.children[e-1],i=t.children[e];let a=r,s=r.relX,o=i,c=i.relX,l=!0;for(;a&&o;){a.bottom>n.lowY&&(n=n.next);const r=s+a.prelim-(c+o.prelim)+a.xSize/2+o.xSize/2+a.spacing(o);(r>0||r<0&&l)&&(c+=r,f(i,r),g(t,e,n.index,r)),l=!1;const h=a.bottom,d=o.bottom;h<=d&&(a=x(a),a&&(s+=a.relX)),h>=d&&(o=m(o),o&&(c+=o.relX))}!a&&o?y(t,e,o,c):a&&!o&&v(t,e,a,s)},f=(t,e)=>{t.relX+=e,t.lExtRelX+=e,t.rExtRelX+=e},g=(t,e,n,r)=>{const i=t.children[e],a=e-n;if(a>1){const e=r/a;t.children[n+1].shift+=e,i.shift-=e,i.change-=r-e}},m=t=>t.hasChildren?t.firstChild:t.lThr,x=t=>t.hasChildren?t.lastChild:t.rThr,y=(t,e,n,r)=>{const i=t.firstChild,a=i.lExt,s=t.children[e];a.lThr=n;const o=r-n.relX-i.lExtRelX;a.relX+=o,a.prelim-=o,i.lExt=s.lExt,i.lExtRelX=s.lExtRelX},v=(t,e,n,r)=>{const i=t.children[e],a=i.rExt,s=t.children[e-1];a.rThr=n;const o=r-n.relX-i.rExtRelX;a.relX+=o,a.prelim-=o,i.rExt=s.rExt,i.rExtRelX=s.rExtRelX},z=t=>{if(t.hasChildren){const e=t.firstChild,n=t.lastChild,r=(e.prelim+e.relX-e.xSize/2+n.relX+n.prelim+n.xSize/2)/2;Object.assign(t,{prelim:r,lExt:e.lExt,lExtRelX:e.lExtRelX,rExt:n.rExt,rExtRelX:n.rExtRelX})}},S=(t,e,n)=>{for(;null!==n&&t>=n.lowY;)n=n.next;return{lowY:t,index:e,next:n}};function j(t,e,n){const r=document.createElement(t);return e&&Object.entries(e).forEach(([t,e])=>{r[t]=e}),n&&Object.entries(n).forEach(([t,e])=>{r.setAttribute(t,e)}),r}const b=function(t){const e={};return function(...n){const r=`${n[0]}`;let i=e[r];return i||(i={value:t(...n)},e[r]=i),i.value}}(t=>{document.head.append(j("link",{rel:"preload",as:"script",href:t}))});function $(t,e){if("script"===t.type)return new Promise((e,n)=>{document.head.append(j("script",Object.assign(Object.assign({},t.data),{},{onload:e,onerror:n})))});if("iife"===t.type){const{fn:n,getParams:r}=t.data;n(...(null==r?void 0:r(e))||[])}}function E(t){"style"===t.type?document.head.append(j("style",{textContent:t.data})):"stylesheet"===t.type&&document.head.append(j("link",Object.assign({rel:"stylesheet"},t.data)))}async function w(t,e){return e=Object.assign({},e),await Promise.all([t.map(t=>(function(t){for(const e of t)E(e)}(t.styles),async function(t,e){const n=t.filter(t=>"script"===t.type);n.length>1&&n.forEach(t=>b(t.data.src));for(const n of t)await $(n,e)}(t.scripts,e)))]),t.map(({transform:t})=>t)}const X=[{type:"iife",data:{fn:t=>{t.options=Object.assign({skipHtmlTags:{"[-]":["code","pre"]}},t.options),t.startup=Object.assign({typeset:!1},t.startup),window.MathJax=t},getParams:t=>[Object.assign({},t.mathJax)]}},{type:"script",data:{src:"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"}}];var O=Object.freeze({__proto__:null,styles:[],scripts:X,transform:function(t,e){var n,r;null==(n=(r=window.MathJax).typeset)||n.call(r,t)}});const k=[{type:"iife",data:{fn:()=>{window.Prism={manual:!0}}}},{type:"script",data:{src:"https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-core.min.js"}},{type:"script",data:{src:"https://cdn.jsdelivr.net/npm/prismjs@1/plugins/autoloader/prism-autoloader.min.js"}}];var C=Object.freeze({__proto__:null,styles:[{type:"stylesheet",data:{href:"https://cdn.jsdelivr.net/npm/prismjs@1/themes/prism.css"}}],scripts:k,transform:function(t,e){const{Prism:n}=window,r=t.flatMap(t=>Array.from(t.querySelectorAll("code[class*=language-]"))).map(t=>{const e=t.className.match(/(?:^|\s)language-(\S+)|$/)[1];if(!n.languages[e])return e;n.highlightElement(t)}).filter(Boolean);r.length&&n.plugins.autoloader.loadLanguages(r,()=>{e.setData(),e.fit()})}}),M=Object.freeze({__proto__:null,mathJax:O,prism:C});const R=Math.random().toString(36).slice(2,8);let I=0;function A(t,e,n="c"){const r=(t,i)=>e(t,()=>{var e;null==(e=t[n])||e.forEach(e=>{r(e,t)})},i);r(t)}function _(t){const e=t.data;return Math.max(6-2*e.d,1.5)}function B(t){const e=[];for(let n=0;n<t.length;n+=1)e.push(t[n]);return e}function T(t){if("string"==typeof t){const e=t;t=t=>t.tagName===e}const e=t;return function(){let t=B(this.childNodes);return e&&(t=t.filter(t=>e(t))),t}}function H(t,...e){const n=(t||"").split(" ").filter(Boolean);return e.forEach(t=>{t&&n.indexOf(t)<0&&n.push(t)}),n.join(" ")}const N=Object.assign((function(t,n,r){const i=(t=t.datum?t:e.select(t)).append("style"),a=e.zoom().on("zoom",(function(){const{transform:t}=e.event;h.attr("transform",t)})),s=t.node(),o=Object.assign({duration:500,nodeFont:"300 16px/20px sans-serif",nodeMinHeight:16,spacingVertical:5,spacingHorizontal:80,autoFit:!1,fitRatio:.95,color:e.scaleOrdinal(e.schemeCategory10),colorDepth:0,paddingX:8},r),c={id:o.id||(I+=1,`mm-${R}-${I}`)},h=t.append("g").attr("class",`${c.id}-g`);t.attr("class",H(t.attr("class"),c.id)),i.text(u()),t.call(a);const d={setData:f,setOptions:p,fit:m};n&&(f(n),m());return d;function u(){const{style:t}=o;return`.${c.id} a { color: #0097e6; }\n.${c.id} a:hover { color: #00a8ff; }\n.${c.id}-g > path { fill: none; }\n.${c.id}-fo > div { font: ${o.nodeFont}; white-space: nowrap; }\n.${c.id}-fo code { padding: .2em .4em; font-size: calc(1em - 2px); color: #555; background-color: #f0f0f0; border-radius: 2px; }\n.${c.id}-fo del { text-decoration: line-through; }\n.${c.id}-fo em { font-style: italic; }\n.${c.id}-fo strong { font-weight: 500; }\n.${c.id}-fo pre { margin: 0; }\n.${c.id}-fo pre[class*=language-] { padding: 0; }\n.${c.id}-g > g { cursor: pointer; }\n${t?t(c.id):""}\n`}function p(t){Object.assign(o,t)}function f(t,e){t||(t=Object.assign({},c.data)),c.data=t,function(t){var e;let n=0,r=0;const{colorDepth:i}=o,a=document.createElement("div"),s=`${c.id}-container`;a.className=H(a.className,`${c.id}-fo`,s);const l=document.createElement("style");if(l.textContent=`\n${u()}\n.${s} {\n position: absolute;\n width: 0;\n height: 0;\n top: -100px;\n left: -100px;\n overflow: hidden;\n font: ${o.nodeFont};\n}\n.${s} > div {\n display: inline-block;\n}\n`,document.body.append(l,a),A(t,(t,e)=>{var s;t.c=null==(s=t.c)?void 0:s.map(t=>Object.assign({},t)),n+=1,o.color(`${r}`);const c=document.createElement("div");c.innerHTML=t.v,a.append(c),t.p=Object.assign(Object.assign({},t.p),{},{i:n,c:r,el:c}),e(),i&&t.d!==i||(r+=1)}),null==(e=N.processors)?void 0:e.length){const t=B(a.childNodes);N.processors.forEach(e=>{e(t,d)})}A(t,(t,e,n)=>{var r;const i=t.p.el.getBoundingClientRect();t.v=t.p.el.innerHTML,t.p.s=[Math.ceil(i.width),Math.max(Math.ceil(i.height),o.nodeMinHeight)],t.p.k=`${(null==n||null==(r=n.p)?void 0:r.i)||""}.${t.p.i}:${t.v}`,e()}),a.remove(),l.remove()}(t),e&&p(e),y()}function g(t){return o.duration?t.transition().duration(o.duration):t}function m(){const{width:n,height:r}=s.getBoundingClientRect(),{minX:i,maxX:l,minY:h,maxY:d}=c,u=d-h,p=l-i,f=Math.min(n/u*o.fitRatio,r/p*o.fitRatio,2),m=e.zoomIdentity.translate((n-u*f)/2-h*f,(r-p*f)/2-i*f).scale(f);g(t).call(a.transform,m)}function x(t){var e;const{data:n}=t;n.p=Object.assign(Object.assign({},n.p),{},{f:!(null==(e=n.p)?void 0:e.f)}),y(t.data)}function y(t){var n,r;if(!c.data)return;const{spacingHorizontal:i}=o,a=l().children(t=>{var e;return!(null==(e=t.p)?void 0:e.f)&&t.c}).nodeSize(t=>{const[e,n]=t.data.p.s;return[n,e+(e?2*o.paddingX:0)+i]}).spacing((t,e)=>t.parent===e.parent?o.spacingVertical:2*o.spacingVertical),s=a.hierarchy(c.data);a(s),function(t,e){A(t,(t,n)=>{t.ySizeInner=t.ySize-e,t.y+=e,n()},"children")}(s,i);const d=s.descendants().reverse(),u=s.links(),p=e.linkHorizontal(),f=e.min(d,t=>t.x-t.xSize/2),y=e.max(d,t=>t.x+t.xSize/2),v=e.min(d,t=>t.y),z=e.max(d,t=>t.y+t.ySizeInner);c.minX=f,c.maxX=y,c.minY=v,c.maxY=z,o.autoFit&&m();const S=t&&d.find(e=>e.data===t)||s,j=null!=(n=S.data.x0)?n:S.x,b=null!=(r=S.data.y0)?r:S.y,$=h.selectAll(T("g")).data(d,t=>t.data.p.k),E=$.enter().append("g").attr("transform",t=>`translate(${b+S.ySizeInner-t.ySizeInner},${j+S.xSize/2-t.xSize})`).on("click",x),w=g($.exit());w.select("rect").attr("width",0).attr("x",t=>t.ySizeInner),w.select("foreignObject").style("opacity",0),w.attr("transform",t=>`translate(${S.y+S.ySizeInner-t.ySizeInner},${S.x+S.xSize/2-t.xSize})`).remove();const X=$.merge(E);g(X).attr("transform",t=>`translate(${t.y},${t.x-t.xSize/2})`),g(X.selectAll(T("rect")).data(t=>[t],t=>t.data.p.k).join(t=>t.append("rect").attr("x",t=>t.ySizeInner).attr("y",t=>t.xSize-_(t)/2).attr("width",0).attr("height",_),t=>t,t=>t.remove())).attr("x",-1).attr("width",t=>t.ySizeInner+2).attr("fill",t=>o.color(t.data.p.c)),g(X.selectAll(T("circle")).data(t=>t.data.c?[t]:[],t=>t.data.p.k).join(t=>t.append("circle").attr("stroke-width","1.5").attr("cx",t=>t.ySizeInner).attr("cy",t=>t.xSize).attr("r",0),t=>t,t=>t.remove())).attr("r",6).attr("stroke",t=>o.color(t.data.p.c)).attr("fill",t=>{var e;return(null==(e=t.data.p)?void 0:e.f)?o.color(t.data.p.c):"#fff"}),g(X.selectAll(T("foreignObject")).data(t=>[t],t=>t.data.p.k).join(t=>{const e=t.append("foreignObject").attr("class",`${c.id}-fo`).attr("x",o.paddingX).attr("y",0).style("opacity",0).attr("height",t=>t.xSize);return e.append("xhtml:div").select((function(t){const e=t.data.p.el.cloneNode(!0);return this.replaceWith(e),e})).attr("xmlns","http://www.w3.org/1999/xhtml"),e},t=>t,t=>t.remove()).attr("width",t=>Math.max(0,t.ySizeInner-2*o.paddingX))).style("opacity",1);const O=h.selectAll(T("path")).data(u,t=>t.target.data.p.k).join(t=>{const e=[b+S.ySizeInner,j+S.xSize/2];return t.insert("path","g").attr("d",p({source:e,target:e}))},t=>t,t=>{const e=[S.y+S.ySizeInner,S.x+S.xSize/2];return g(t).attr("d",p({source:e,target:e})).remove()});g(O).attr("stroke",t=>o.color(t.target.data.p.c)).attr("stroke-width",t=>_(t.target)).attr("d",t=>{const e=[t.source.y+t.source.ySizeInner,t.source.x+t.source.xSize/2],n=[t.target.y,t.target.x+t.target.xSize/2];return p({source:e,target:n})}),d.forEach(t=>{t.data.x0=t.x,t.data.y0=t.y})}}),{processors:[]});t.loadPlugins=async function(t,e){t=t.map(t=>{if("string"==typeof t){const e=t;(t=M[e])||console.warn(`[markmap] Unknown plugin: ${e}`)}return t}).filter(Boolean),N.processors=[...N.processors,...await w(t,e)]},t.markmap=N,t.plugins=M}(this.markmap=this.markmap||{},d3);

@@ -17,2 +17,5 @@ "use strict";

}, mathJax.options);
mathJax.startup = Object.assign({
typeset: false
}, mathJax.startup);
window.MathJax = mathJax;

@@ -19,0 +22,0 @@ },

@@ -11,3 +11,3 @@ "use strict";

const template = "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n<title>Markmap</title>\n<style>\n* {\n margin: 0;\n padding: 0;\n}\n#mindmap {\n display: block;\n width: 100vw;\n height: 100vh;\n}\n</style>\n<!--CSS-->\n</head>\n<body>\n<svg id=\"mindmap\"></svg>\n<!--JS-->\n</body>\n</html>\n";
const baseJs = ['https://cdn.jsdelivr.net/npm/d3@5', 'https://cdn.jsdelivr.net/npm/markmap-lib@0.7.0/dist/browser/view.min.js'].map(src => ({
const baseJs = ['https://cdn.jsdelivr.net/npm/d3@5', 'https://cdn.jsdelivr.net/npm/markmap-lib@0.7.1/dist/browser/view.min.js'].map(src => ({
type: 'script',

@@ -31,5 +31,5 @@ data: {

markmap
} = window;
} = window.markmap;
markmap.processors = processors;
markmap.markmap('svg#mindmap', data);
markmap('svg#mindmap', data);
},

@@ -36,0 +36,0 @@ getParams: ({

@@ -23,3 +23,3 @@ "use strict";

function htmlOpen(tagName, attrs, autoClose = false) {
function htmlOpen(tagName, attrs) {
const attrStr = attrs ? Object.entries(attrs).map(([key, value]) => {

@@ -39,3 +39,3 @@ if (value == null || value === false) return;

function wrapHtml(tagName, content, attrs) {
if (content == null) return htmlOpen(tagName, attrs, true);
if (content == null) return htmlOpen(tagName, attrs);
return htmlOpen(tagName, attrs) + (content || '') + htmlClose(tagName);

@@ -42,0 +42,0 @@ }

@@ -111,2 +111,8 @@ "use strict";

updateStyle();
svg.call(zoom);
const mm = {
setData,
setOptions,
fit
};

@@ -118,8 +124,2 @@ if (data) {

svg.call(zoom);
const mm = {
setData,
setOptions,
fit
};
return mm;

@@ -126,0 +126,0 @@

{
"name": "markmap-lib",
"version": "0.7.0",
"version": "0.7.1",
"description": "Visualize your Markdown as mindmaps with Markmap",

@@ -5,0 +5,0 @@ "author": "Gerald <i@gerald.top>",

export declare function escapeHtml(html: string): string;
export declare function escapeScript(content: string): string;
export declare function htmlOpen(tagName: string, attrs?: any, autoClose?: boolean): string;
export declare function htmlOpen(tagName: string, attrs?: any): string;
export declare function htmlClose(tagName: string): string;
export declare function wrapHtml(tagName: string, content?: string, attrs?: any): string;
export declare function wrapStyle(text: string, style: any): string;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc