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.3.0-1 to 0.3.0-2

7

dist/index.js

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

/*! markmap-lib v0.3.0-1 | MIT License */
/*! markmap-lib v0.3.0-2 | MIT License */
'use strict';

@@ -79,3 +79,3 @@

function cleanNode(node) {
function cleanNode(node, depth = 0) {
if (node.t === 'heading') {

@@ -124,3 +124,3 @@ // drop all paragraphs

node.children.forEach(cleanNode);
node.children.forEach(child => cleanNode(child, depth + 1));
}

@@ -144,2 +144,3 @@

node.v = content;
node.d = depth;
delete node.p;

@@ -146,0 +147,0 @@ }

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

/*! markmap-lib v0.3.0-1 | MIT License */
/*! markmap-lib v0.3.0-2 | MIT License */
'use strict';

@@ -73,3 +73,3 @@

function cleanNode(node) {
function cleanNode(node, depth = 0) {
if (node.t === 'heading') {

@@ -118,3 +118,3 @@ // drop all paragraphs

node.children.forEach(cleanNode);
node.children.forEach(child => cleanNode(child, depth + 1));
}

@@ -138,2 +138,3 @@

node.v = content;
node.d = depth;
delete node.p;

@@ -140,0 +141,0 @@ }

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

/*! markmap-lib v0.3.0-1 | MIT License */
/*! markmap-lib v0.3.0-2 | MIT License */
'use strict';

@@ -561,4 +561,2 @@

const color = d3.scaleOrdinal(d3.schemeCategory10);
function walkTree(tree, callback) {

@@ -607,32 +605,12 @@ const walk = item => callback(item, () => {

const data = nodeData.data;
let {
d
} = data;
const {
v,
children
} = data;
if (v.length && (children == null ? void 0 : children.length) === 1 && children[0].v.length) {
d += 1;
}
return Math.max(6 - 2 * d, 1.5);
return Math.max(6 - 2 * data.d, 1.5);
}
function addIds(node, d = 0) {
let id = 1;
let i = 1;
walkTree(node, (item, next) => {
color(`${i}`); // preload colors
item.p = {
id,
i,
...item.p
};
id += 1;
next();
if (!d || item.d === d) i += 1;
function getKey(v) {
const result = ['<'];
v.forEach(item => {
if (item.t === 'text') result.push(item.v.replace(/[<|&]/g, m => `&${m}`));else if (item.children) result.push(getKey(item.children));
});
result.push('>');
return result.join('');
}

@@ -650,3 +628,3 @@

function render(svg, data) {
function markmap(svg, data, opts) {
svg = svg.datum ? svg : d3.select(svg);

@@ -664,5 +642,3 @@ const classList = (svg.attr('class') || '').split(' ').filter(Boolean);

}).data([0]).join('g');
addIds(data, 0);
const state = {
data,
const options = {
duration: 500,

@@ -673,7 +649,69 @@ nodeFont: '300 16px sans-serif',

spacingHorizontal: 80,
fit: true
autoFit: false,
color: d3.scaleOrdinal(d3.schemeCategory10),
colorDepth: 0,
...opts
};
renderData(state.data);
state.fit = false;
const state = {};
if (data) {
setData(data);
fit(); // always fit for the first render
}
return {
setData,
setOptions,
fit
};
function addKeys(node) {
let i = 1;
const {
colorDepth
} = options;
walkTree(node, (item, next) => {
var _item$v;
options.color(`${i}`); // preload colors
item.p = {
i,
...item.p
};
if ((_item$v = item.v) == null ? void 0 : _item$v.length) {
item.p.k = getKey(item.v);
}
next();
if (!colorDepth || item.d === colorDepth) i += 1;
});
}
function setOptions(opts) {
Object.assign(options, opts);
}
function setData(data, opts) {
addKeys(data);
state.data = data;
if (opts) setOptions(opts);
renderData(data);
}
function fit() {
const {
minX,
maxX,
minY,
maxY,
offsetWidth,
offsetHeight
} = state;
const naturalWidth = maxY - minY;
const naturalHeight = maxX - minX;
g.attr('transform', `translate(${(offsetWidth - naturalWidth) / 2 - minY},${(offsetHeight - naturalHeight) / 2 - minX})`);
}
function handleClick(d) {

@@ -712,3 +750,3 @@ d.data.fold = !d.data.fold;

return ((_d$p3 = d.p) == null ? void 0 : _d$p3.newline) ? state.lineHeight : null;
return ((_d$p3 = d.p) == null ? void 0 : _d$p3.newline) ? options.lineHeight : null;
});

@@ -730,12 +768,13 @@ }

svg.attr('style', `font: ${state.nodeFont}`);
if (!state.data) return;
svg.attr('style', `font: ${options.nodeFont}`);
const layout = flextree().children(d => !d.fold && d.children).nodeSize(d => {
const [width, rows] = getTextRect(d.data.v, state.nodeFont);
return [rows * state.lineHeight, width + 16];
const [width, rows] = getTextRect(d.data.v, options.nodeFont);
return [rows * options.lineHeight, width + 16];
}).spacing((a, b) => {
return a.parent === b.parent ? state.spacingVertical : state.spacingVertical * 2;
return a.parent === b.parent ? options.spacingVertical : options.spacingVertical * 2;
});
const tree = layout.hierarchy(state.data);
layout(tree);
addSpacing(tree, state.spacingHorizontal);
addSpacing(tree, options.spacingHorizontal);
const descendants = tree.descendants().reverse();

@@ -748,4 +787,2 @@ const links = tree.links();

const maxY = d3.max(descendants, d => d.y + d.ySize);
const naturalWidth = maxY - minY;
const naturalHeight = maxX - minX;
const {

@@ -755,7 +792,9 @@ width: offsetWidth,

} = svgNode.getBoundingClientRect();
if (state.fit) {
g.attr('transform', `translate(${(offsetWidth - naturalWidth) / 2 - minY},${(offsetHeight - naturalHeight) / 2 - minX})`);
}
state.minX = minX;
state.maxX = maxX;
state.minY = minY;
state.maxY = maxY;
state.offsetWidth = offsetWidth;
state.offsetHeight = offsetHeight;
if (options.autoFit) fit();
const origin = originData ? descendants.find(item => item.data === originData) : tree;

@@ -765,5 +804,5 @@ const x0 = (_origin$data$x = origin.data.x0) != null ? _origin$data$x : origin.x;

const node = g.selectAll('g.markmap-node').data(descendants, d => d.data.p.id);
const node = g.selectAll('g.markmap-node').data(descendants, d => d.data.p.k);
const nodeEnter = node.enter().append('g').attr('class', 'markmap-node').attr("transform", d => `translate(${y0 + origin.ySize - d.ySize},${x0 + origin.xSize / 2})`).on('click', handleClick);
const nodeExit = node.exit().transition().duration(state.duration);
const nodeExit = node.exit().transition().duration(options.duration);
nodeExit.select('rect').attr('width', 0).attr('x', d => d.ySize);

@@ -773,14 +812,14 @@ nodeExit.select('text').attr('fill-opacity', 0);

const nodeMerge = node.merge(nodeEnter);
nodeMerge.transition().duration(state.duration).attr("transform", d => `translate(${d.y},${d.x + d.xSize / 2})`);
nodeMerge.selectAll('rect').data(d => [d]).join(enter => {
return enter.append('rect').attr("y", -1).attr('x', d => d.ySize).attr('width', 0).attr('height', linkWidth).attr('fill', d => color(d.data.p.i));
}, update => update, exit => exit.remove()).transition().duration(state.duration).attr('x', -1).attr('width', d => d.ySize + 2);
nodeMerge.selectAll('circle').data(d => d.data.children ? [d] : []).join(enter => {
return enter.append('circle').attr('cx', d => d.ySize).attr('stroke-width', '1.5').attr('stroke', d => color(d.data.p.i)).attr("r", 0);
}, update => update, exit => exit.remove()).transition().duration(state.duration).attr('r', 6).attr("fill", d => d.data.fold ? color(d.data.p.i) : '#fff');
nodeMerge.selectAll('text').data(d => [d]).join(enter => {
return enter.append('text').attr("x", 8).attr('y', d => state.lineHeight - 4 - d.xSize).attr("text-anchor", "start").attr('fill-opacity', 0).call(renderText);
}, update => update, exit => exit.remove()).transition().duration(state.duration).attr('fill-opacity', 1); // Update the links
nodeMerge.transition().duration(options.duration).attr("transform", d => `translate(${d.y},${d.x + d.xSize / 2})`);
nodeMerge.selectAll('rect').data(d => [d], d => d.data.p.k).join(enter => {
return enter.append('rect').attr("y", -1).attr('x', d => d.ySize).attr('width', 0).attr('height', linkWidth);
}, update => update, exit => exit.remove()).transition().duration(options.duration).attr('x', -1).attr('width', d => d.ySize + 2).attr('fill', d => options.color(d.data.p.i));
nodeMerge.selectAll('circle').data(d => d.data.children ? [d] : [], d => d.data.p.k).join(enter => {
return enter.append('circle').attr('stroke-width', '1.5').attr("r", 0);
}, update => update, exit => exit.remove()).transition().duration(options.duration).attr('cx', d => d.ySize).attr('r', 6).attr('stroke', d => options.color(d.data.p.i)).attr("fill", d => d.data.fold ? options.color(d.data.p.i) : '#fff');
nodeMerge.selectAll('text').data(d => [d], d => d.data.p.k).join(enter => {
return enter.append('text').attr("x", 8).attr('y', d => options.lineHeight - 4 - d.xSize).attr("text-anchor", "start").attr('fill-opacity', 0).call(renderText);
}, update => update, exit => exit.remove()).transition().duration(options.duration).attr('fill-opacity', 1); // Update the links
g.selectAll('path.markmap-link').data(links, d => d.target.data.p.id).join(enter => {
g.selectAll('path.markmap-link').data(links, d => d.target.data.p.k).join(enter => {
const source = [y0 + origin.ySize, x0 + origin.xSize / 2];

@@ -793,7 +832,7 @@ return enter.insert('path', 'g').attr('d', linkShape({

const source = [origin.y + origin.ySize, origin.x + origin.xSize / 2];
return exit.transition().duration(state.duration).attr('d', linkShape({
return exit.transition().duration(options.duration).attr('d', linkShape({
source,
target: source
})).remove();
}).transition().duration(state.duration).attr("class", "markmap-link").attr('stroke', d => color(d.target.data.p.i)).attr('stroke-width', d => linkWidth(d.target)).attr("d", d => {
}).transition().duration(options.duration).attr("class", "markmap-link").attr('stroke', d => options.color(d.target.data.p.i)).attr('stroke-width', d => linkWidth(d.target)).attr("d", d => {
const source = [d.source.y + d.source.ySize, d.source.x + d.source.xSize / 2];

@@ -813,2 +852,2 @@ const target = [d.target.y, d.target.x + d.target.xSize / 2];

exports.render = render;
exports.markmap = markmap;

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

/*! markmap-lib v0.3.0-1 | MIT License */
/*! markmap-lib v0.3.0-2 | MIT License */
(function (exports, d3) {

@@ -560,4 +560,2 @@ 'use strict';

const color = d3.scaleOrdinal(d3.schemeCategory10);
function walkTree(tree, callback) {

@@ -606,32 +604,12 @@ const walk = item => callback(item, () => {

const data = nodeData.data;
let {
d
} = data;
const {
v,
children
} = data;
if (v.length && (children == null ? void 0 : children.length) === 1 && children[0].v.length) {
d += 1;
}
return Math.max(6 - 2 * d, 1.5);
return Math.max(6 - 2 * data.d, 1.5);
}
function addIds(node, d = 0) {
let id = 1;
let i = 1;
walkTree(node, (item, next) => {
color(`${i}`); // preload colors
item.p = {
id,
i,
...item.p
};
id += 1;
next();
if (!d || item.d === d) i += 1;
function getKey(v) {
const result = ['<'];
v.forEach(item => {
if (item.t === 'text') result.push(item.v.replace(/[<|&]/g, m => `&${m}`));else if (item.children) result.push(getKey(item.children));
});
result.push('>');
return result.join('');
}

@@ -649,3 +627,3 @@

function render(svg, data) {
function markmap(svg, data, opts) {
svg = svg.datum ? svg : d3.select(svg);

@@ -663,5 +641,3 @@ const classList = (svg.attr('class') || '').split(' ').filter(Boolean);

}).data([0]).join('g');
addIds(data, 0);
const state = {
data,
const options = {
duration: 500,

@@ -672,7 +648,69 @@ nodeFont: '300 16px sans-serif',

spacingHorizontal: 80,
fit: true
autoFit: false,
color: d3.scaleOrdinal(d3.schemeCategory10),
colorDepth: 0,
...opts
};
renderData(state.data);
state.fit = false;
const state = {};
if (data) {
setData(data);
fit(); // always fit for the first render
}
return {
setData,
setOptions,
fit
};
function addKeys(node) {
let i = 1;
const {
colorDepth
} = options;
walkTree(node, (item, next) => {
var _item$v;
options.color(`${i}`); // preload colors
item.p = {
i,
...item.p
};
if ((_item$v = item.v) == null ? void 0 : _item$v.length) {
item.p.k = getKey(item.v);
}
next();
if (!colorDepth || item.d === colorDepth) i += 1;
});
}
function setOptions(opts) {
Object.assign(options, opts);
}
function setData(data, opts) {
addKeys(data);
state.data = data;
if (opts) setOptions(opts);
renderData(data);
}
function fit() {
const {
minX,
maxX,
minY,
maxY,
offsetWidth,
offsetHeight
} = state;
const naturalWidth = maxY - minY;
const naturalHeight = maxX - minX;
g.attr('transform', `translate(${(offsetWidth - naturalWidth) / 2 - minY},${(offsetHeight - naturalHeight) / 2 - minX})`);
}
function handleClick(d) {

@@ -711,3 +749,3 @@ d.data.fold = !d.data.fold;

return ((_d$p3 = d.p) == null ? void 0 : _d$p3.newline) ? state.lineHeight : null;
return ((_d$p3 = d.p) == null ? void 0 : _d$p3.newline) ? options.lineHeight : null;
});

@@ -729,12 +767,13 @@ }

svg.attr('style', `font: ${state.nodeFont}`);
if (!state.data) return;
svg.attr('style', `font: ${options.nodeFont}`);
const layout = flextree().children(d => !d.fold && d.children).nodeSize(d => {
const [width, rows] = getTextRect(d.data.v, state.nodeFont);
return [rows * state.lineHeight, width + 16];
const [width, rows] = getTextRect(d.data.v, options.nodeFont);
return [rows * options.lineHeight, width + 16];
}).spacing((a, b) => {
return a.parent === b.parent ? state.spacingVertical : state.spacingVertical * 2;
return a.parent === b.parent ? options.spacingVertical : options.spacingVertical * 2;
});
const tree = layout.hierarchy(state.data);
layout(tree);
addSpacing(tree, state.spacingHorizontal);
addSpacing(tree, options.spacingHorizontal);
const descendants = tree.descendants().reverse();

@@ -747,4 +786,2 @@ const links = tree.links();

const maxY = d3.max(descendants, d => d.y + d.ySize);
const naturalWidth = maxY - minY;
const naturalHeight = maxX - minX;
const {

@@ -754,7 +791,9 @@ width: offsetWidth,

} = svgNode.getBoundingClientRect();
if (state.fit) {
g.attr('transform', `translate(${(offsetWidth - naturalWidth) / 2 - minY},${(offsetHeight - naturalHeight) / 2 - minX})`);
}
state.minX = minX;
state.maxX = maxX;
state.minY = minY;
state.maxY = maxY;
state.offsetWidth = offsetWidth;
state.offsetHeight = offsetHeight;
if (options.autoFit) fit();
const origin = originData ? descendants.find(item => item.data === originData) : tree;

@@ -764,5 +803,5 @@ const x0 = (_origin$data$x = origin.data.x0) != null ? _origin$data$x : origin.x;

const node = g.selectAll('g.markmap-node').data(descendants, d => d.data.p.id);
const node = g.selectAll('g.markmap-node').data(descendants, d => d.data.p.k);
const nodeEnter = node.enter().append('g').attr('class', 'markmap-node').attr("transform", d => `translate(${y0 + origin.ySize - d.ySize},${x0 + origin.xSize / 2})`).on('click', handleClick);
const nodeExit = node.exit().transition().duration(state.duration);
const nodeExit = node.exit().transition().duration(options.duration);
nodeExit.select('rect').attr('width', 0).attr('x', d => d.ySize);

@@ -772,14 +811,14 @@ nodeExit.select('text').attr('fill-opacity', 0);

const nodeMerge = node.merge(nodeEnter);
nodeMerge.transition().duration(state.duration).attr("transform", d => `translate(${d.y},${d.x + d.xSize / 2})`);
nodeMerge.selectAll('rect').data(d => [d]).join(enter => {
return enter.append('rect').attr("y", -1).attr('x', d => d.ySize).attr('width', 0).attr('height', linkWidth).attr('fill', d => color(d.data.p.i));
}, update => update, exit => exit.remove()).transition().duration(state.duration).attr('x', -1).attr('width', d => d.ySize + 2);
nodeMerge.selectAll('circle').data(d => d.data.children ? [d] : []).join(enter => {
return enter.append('circle').attr('cx', d => d.ySize).attr('stroke-width', '1.5').attr('stroke', d => color(d.data.p.i)).attr("r", 0);
}, update => update, exit => exit.remove()).transition().duration(state.duration).attr('r', 6).attr("fill", d => d.data.fold ? color(d.data.p.i) : '#fff');
nodeMerge.selectAll('text').data(d => [d]).join(enter => {
return enter.append('text').attr("x", 8).attr('y', d => state.lineHeight - 4 - d.xSize).attr("text-anchor", "start").attr('fill-opacity', 0).call(renderText);
}, update => update, exit => exit.remove()).transition().duration(state.duration).attr('fill-opacity', 1); // Update the links
nodeMerge.transition().duration(options.duration).attr("transform", d => `translate(${d.y},${d.x + d.xSize / 2})`);
nodeMerge.selectAll('rect').data(d => [d], d => d.data.p.k).join(enter => {
return enter.append('rect').attr("y", -1).attr('x', d => d.ySize).attr('width', 0).attr('height', linkWidth);
}, update => update, exit => exit.remove()).transition().duration(options.duration).attr('x', -1).attr('width', d => d.ySize + 2).attr('fill', d => options.color(d.data.p.i));
nodeMerge.selectAll('circle').data(d => d.data.children ? [d] : [], d => d.data.p.k).join(enter => {
return enter.append('circle').attr('stroke-width', '1.5').attr("r", 0);
}, update => update, exit => exit.remove()).transition().duration(options.duration).attr('cx', d => d.ySize).attr('r', 6).attr('stroke', d => options.color(d.data.p.i)).attr("fill", d => d.data.fold ? options.color(d.data.p.i) : '#fff');
nodeMerge.selectAll('text').data(d => [d], d => d.data.p.k).join(enter => {
return enter.append('text').attr("x", 8).attr('y', d => options.lineHeight - 4 - d.xSize).attr("text-anchor", "start").attr('fill-opacity', 0).call(renderText);
}, update => update, exit => exit.remove()).transition().duration(options.duration).attr('fill-opacity', 1); // Update the links
g.selectAll('path.markmap-link').data(links, d => d.target.data.p.id).join(enter => {
g.selectAll('path.markmap-link').data(links, d => d.target.data.p.k).join(enter => {
const source = [y0 + origin.ySize, x0 + origin.xSize / 2];

@@ -792,7 +831,7 @@ return enter.insert('path', 'g').attr('d', linkShape({

const source = [origin.y + origin.ySize, origin.x + origin.xSize / 2];
return exit.transition().duration(state.duration).attr('d', linkShape({
return exit.transition().duration(options.duration).attr('d', linkShape({
source,
target: source
})).remove();
}).transition().duration(state.duration).attr("class", "markmap-link").attr('stroke', d => color(d.target.data.p.i)).attr('stroke-width', d => linkWidth(d.target)).attr("d", d => {
}).transition().duration(options.duration).attr("class", "markmap-link").attr('stroke', d => options.color(d.target.data.p.i)).attr('stroke-width', d => linkWidth(d.target)).attr("d", d => {
const source = [d.source.y + d.source.ySize, d.source.x + d.source.xSize / 2];

@@ -812,4 +851,4 @@ const target = [d.target.y, d.target.x + d.target.xSize / 2];

exports.render = render;
exports.markmap = markmap;
}(this.markmap = this.markmap || {}, d3));

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

/*! markmap-lib v0.3.0-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,s,c,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))&&(c=a.length))for(n.children=new Array(c),s=c-1;s>=0;--s)u.push(r=n.children[s]=new o(a[s])),r.parent=n,r.depth=n.depth+1;return h.eachBefore(l)}function i(t){return t.children}function a(t){t.data=t.data.data}function l(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,l=[a];do{for(e=l.reverse(),l=[];a=e.pop();)if(t(a),n=a.children)for(r=0,i=n.length;r<i;++r)l.push(n[r])}while(l.length);return this},eachAfter:function(t){for(var e,n,r,i=this,a=[i],l=[];i=a.pop();)if(l.push(i),e=i.children)for(n=0,r=e.length;n<r;++n)a.push(e[n]);for(;i=l.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 s=Object.freeze({children:t=>t.children,nodeSize:t=>t.data.size,spacing:0});function c(t){const e=Object.assign({},s,t);function n(t){const n=e[t];return"function"==typeof n?n:()=>n}function i(t){const e=l(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=l(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 l(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 l=n(e)||[];return a.children=0===l.length?null:l.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 l(a(),t,r)},dump(t){const e=n("nodeSize"),r=t=>n=>{const i=t+" ",a=t+" ",{x:l,y:o}=n,s=e(n),c=n.children||[],h=0===c.length?" ":`,${i}children: [${a}${c.map(r(a)).join(a)}${i}],${t}`;return`{ size: [${s.join(", ")}],${i}x: ${l}, y: ${o}${h}},`};return r("\n")(t)}}),i}c.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,E(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,l=r.relX,o=i,s=i.relX,c=!0;for(;a&&o;){a.bottom>n.lowY&&(n=n.next);const r=l+a.prelim-(s+o.prelim)+a.xSize/2+o.xSize/2+a.spacing(o);(r>0||r<0&&c)&&(s+=r,f(i,r),x(t,e,n.index,r)),c=!1;const h=a.bottom,d=o.bottom;h<=d&&(a=m(a),a&&(l+=a.relX)),h>=d&&(o=g(o),o&&(s+=o.relX))}!a&&o?y(t,e,o,s):a&&!o&&v(t,e,a,l)},f=(t,e)=>{t.relX+=e,t.lExtRelX+=e,t.rExtRelX+=e},x=(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}},g=t=>t.hasChildren?t.firstChild:t.lThr,m=t=>t.hasChildren?t.lastChild:t.rThr,y=(t,e,n,r)=>{const i=t.firstChild,a=i.lExt,l=t.children[e];a.lThr=n;const o=r-n.relX-i.lExtRelX;a.relX+=o,a.prelim-=o,i.lExt=l.lExt,i.lExtRelX=l.lExtRelX},v=(t,e,n,r)=>{const i=t.children[e],a=i.rExt,l=t.children[e-1];a.rThr=n;const o=r-n.relX-i.rExtRelX;a.relX+=o,a.prelim-=o,i.rExt=l.rExt,i.rExtRelX=l.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})}},E=(t,e,n)=>{for(;null!==n&&t>=n.lowY;)n=n.next;return{lowY:t,index:e,next:n}},S=e.scaleOrdinal(e.schemeCategory10);function X(t,e){const n=t=>e(t,()=>{var e;null==(e=t.children)||e.forEach(n)});n(t)}let k;function w(t){const e=t.data;let{d:n}=e;const{v:r,children:i}=e;return r.length&&1===(null==i?void 0:i.length)&&i[0].v.length&&(n+=1),Math.max(6-2*n,1.5)}t.render=function(t,n){const r=((t=t.datum?t:e.select(t)).attr("class")||"").split(" ").filter(Boolean);r.indexOf("markmap")<0&&(r.push("markmap"),t.attr("class",r.join(" ")));const i=t.node(),a=t.selectAll((function(){return this.childNodes})).data([0]).join("g");!function(t,e=0){let n=1,r=1;X(t,(t,i)=>{S(`${r}`),t.p={id:n,i:r,...t.p},n+=1,i(),e&&t.d!==e||(r+=1)})}(n,0);const l={data:n,duration:500,nodeFont:"300 16px sans-serif",lineHeight:20,spacingVertical:5,spacingHorizontal:80,fit:!0};function o(t){t.data.fold=!t.data.fold,d(t.data)}function s(t){e.event.preventDefault(),window.open(t.p.href)}function h(t){return t.selectAll(".markmap-text").data(t=>t.data.v).enter().each((function(t){!function t(n,r){if("link"===r.t){n.append("a").attr("href",r.p.href).attr("title",r.p.title).on("click",s).selectAll(".markmap-text").data(t=>t.children).enter().each((function(n){t(e.select(this),n)}))}"text"===r.t&&n.append("tspan").text(r.v).attr("class",t=>{var e;const n=(null==(e=t.p)?void 0:e.style)||{};return["markmap-text",n.em&&"markmap-em",n.strong&&"markmap-strong"].filter(Boolean).join(" ")}).attr("x",t=>{var e;return(null==(e=t.p)?void 0:e.newline)?8:null}).attr("dy",t=>{var e;return(null==(e=t.p)?void 0:e.newline)?l.lineHeight:null})}(e.select(this),t)})),t}function d(n){var r,s;t.attr("style",`font: ${l.nodeFont}`);const d=c().children(t=>!t.fold&&t.children).nodeSize(t=>{const[e,n]=function(t,e){k||(k=document.createElement("canvas"));const n=k.getContext("2d");n.font=e;let r=0,i=0,a=0;const l=t=>{if("text"===t.t){t.p={...t.p},!i&&a&&(t.p.newline=!0);const e=n.measureText(t.v);i+=e.width,r<i&&(r=i)}else"softbreak"===t.t?(i=0,a+=1):"link"===t.t&&t.children.forEach(l)};return t.forEach(l),[r,a+1]}(t.data.v,l.nodeFont);return[n*l.lineHeight,e+16]}).spacing((t,e)=>t.parent===e.parent?l.spacingVertical:2*l.spacingVertical),u=d.hierarchy(l.data);d(u),function(t,e){let n=0;X(t,(t,r)=>{t.y+=n*e,n+=1,r(),n-=1})}(u,l.spacingHorizontal);const p=u.descendants().reverse(),f=u.links(),x=e.linkHorizontal(),g=e.min(p,t=>t.x),m=e.max(p,t=>t.x),y=e.min(p,t=>t.y),v=e.max(p,t=>t.y+t.ySize)-y,z=m-g,{width:E,height:C}=i.getBoundingClientRect();l.fit&&a.attr("transform",`translate(${(E-v)/2-y},${(C-z)/2-g})`);const $=n?p.find(t=>t.data===n):u,b=null!=(r=$.data.x0)?r:$.x,j=null!=(s=$.data.y0)?s:$.y,R=a.selectAll("g.markmap-node").data(p,t=>t.data.p.id),A=R.enter().append("g").attr("class","markmap-node").attr("transform",t=>`translate(${j+$.ySize-t.ySize},${b+$.xSize/2})`).on("click",o),O=R.exit().transition().duration(l.duration);O.select("rect").attr("width",0).attr("x",t=>t.ySize),O.select("text").attr("fill-opacity",0),O.attr("transform",t=>`translate(${$.y+$.ySize-t.ySize},${$.x+$.xSize/2})`).remove();const B=R.merge(A);B.transition().duration(l.duration).attr("transform",t=>`translate(${t.y},${t.x+t.xSize/2})`),B.selectAll("rect").data(t=>[t]).join(t=>t.append("rect").attr("y",-1).attr("x",t=>t.ySize).attr("width",0).attr("height",w).attr("fill",t=>S(t.data.p.i)),t=>t,t=>t.remove()).transition().duration(l.duration).attr("x",-1).attr("width",t=>t.ySize+2),B.selectAll("circle").data(t=>t.data.children?[t]:[]).join(t=>t.append("circle").attr("cx",t=>t.ySize).attr("stroke-width","1.5").attr("stroke",t=>S(t.data.p.i)).attr("r",0),t=>t,t=>t.remove()).transition().duration(l.duration).attr("r",6).attr("fill",t=>t.data.fold?S(t.data.p.i):"#fff"),B.selectAll("text").data(t=>[t]).join(t=>t.append("text").attr("x",8).attr("y",t=>l.lineHeight-4-t.xSize).attr("text-anchor","start").attr("fill-opacity",0).call(h),t=>t,t=>t.remove()).transition().duration(l.duration).attr("fill-opacity",1),a.selectAll("path.markmap-link").data(f,t=>t.target.data.p.id).join(t=>{const e=[j+$.ySize,b+$.xSize/2];return t.insert("path","g").attr("d",x({source:e,target:e}))},t=>t,t=>{const e=[$.y+$.ySize,$.x+$.xSize/2];return t.transition().duration(l.duration).attr("d",x({source:e,target:e})).remove()}).transition().duration(l.duration).attr("class","markmap-link").attr("stroke",t=>S(t.target.data.p.i)).attr("stroke-width",t=>w(t.target)).attr("d",t=>{const e=[t.source.y+t.source.ySize,t.source.x+t.source.xSize/2],n=[t.target.y,t.target.x+t.target.xSize/2];return x({source:e,target:n})}),p.forEach(t=>{t.data.x0=t.x,t.data.y0=t.y})}d(l.data),l.fit=!1}}(this.markmap=this.markmap||{},d3);
/*! markmap-lib v0.3.0-2 | 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,s,c,h=new l(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))&&(c=a.length))for(n.children=new Array(c),s=c-1;s>=0;--s)u.push(r=n.children[s]=new l(a[s])),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 l(t){this.data=t,this.depth=this.height=0,this.parent=null}l.prototype=r.prototype={constructor:l,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 s=Object.freeze({children:t=>t.children,nodeSize:t=>t.data.size,spacing:0});function c(t){const e=Object.assign({},s,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:l}=n,s=e(n),c=n.children||[],h=0===c.length?" ":`,${i}children: [${a}${c.map(r(a)).join(a)}${i}],${t}`;return`{ size: [${s.join(", ")}],${i}x: ${o}, y: ${l}${h}},`};return r("\n")(t)}}),i}c.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,E(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,l=i,s=i.relX,c=!0;for(;a&&l;){a.bottom>n.lowY&&(n=n.next);const r=o+a.prelim-(s+l.prelim)+a.xSize/2+l.xSize/2+a.spacing(l);(r>0||r<0&&c)&&(s+=r,f(i,r),x(t,e,n.index,r)),c=!1;const h=a.bottom,d=l.bottom;h<=d&&(a=m(a),a&&(o+=a.relX)),h>=d&&(l=g(l),l&&(s+=l.relX))}!a&&l?y(t,e,l,s):a&&!l&&v(t,e,a,o)},f=(t,e)=>{t.relX+=e,t.lExtRelX+=e,t.rExtRelX+=e},x=(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}},g=t=>t.hasChildren?t.firstChild:t.lThr,m=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 l=r-n.relX-i.lExtRelX;a.relX+=l,a.prelim-=l,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 l=r-n.relX-i.rExtRelX;a.relX+=l,a.prelim-=l,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})}},E=(t,e,n)=>{for(;null!==n&&t>=n.lowY;)n=n.next;return{lowY:t,index:e,next:n}};function S(t,e){const n=t=>e(t,()=>{var e;null==(e=t.children)||e.forEach(n)});n(t)}let X;function k(t){const e=t.data;return Math.max(6-2*e.d,1.5)}t.markmap=function(t,n,r){const i=((t=t.datum?t:e.select(t)).attr("class")||"").split(" ").filter(Boolean);i.indexOf("markmap")<0&&(i.push("markmap"),t.attr("class",i.join(" ")));const a=t.node(),o=t.selectAll((function(){return this.childNodes})).data([0]).join("g"),l={duration:500,nodeFont:"300 16px sans-serif",lineHeight:20,spacingVertical:5,spacingHorizontal:80,autoFit:!1,color:e.scaleOrdinal(e.schemeCategory10),colorDepth:0,...r},s={};return n&&(u(n),p()),{setData:u,setOptions:d,fit:p};function h(t){let e=1;const{colorDepth:n}=l;S(t,(t,r)=>{var i;l.color(`${e}`),t.p={i:e,...t.p},(null==(i=t.v)?void 0:i.length)&&(t.p.k=function t(e){const n=["<"];return e.forEach(e=>{"text"===e.t?n.push(e.v.replace(/[<|&]/g,t=>`&${t}`)):e.children&&n.push(t(e.children))}),n.push(">"),n.join("")}(t.v)),r(),n&&t.d!==n||(e+=1)})}function d(t){Object.assign(l,t)}function u(t,e){h(t),s.data=t,e&&d(e),m(t)}function p(){const{minX:t,maxX:e,minY:n,maxY:r,offsetWidth:i,offsetHeight:a}=s,l=r-n,c=e-t;o.attr("transform",`translate(${(i-l)/2-n},${(a-c)/2-t})`)}function f(t){t.data.fold=!t.data.fold,m(t.data)}function x(t){e.event.preventDefault(),window.open(t.p.href)}function g(t){return t.selectAll(".markmap-text").data(t=>t.data.v).enter().each((function(t){!function t(n,r){if("link"===r.t){n.append("a").attr("href",r.p.href).attr("title",r.p.title).on("click",x).selectAll(".markmap-text").data(t=>t.children).enter().each((function(n){t(e.select(this),n)}))}"text"===r.t&&n.append("tspan").text(r.v).attr("class",t=>{var e;const n=(null==(e=t.p)?void 0:e.style)||{};return["markmap-text",n.em&&"markmap-em",n.strong&&"markmap-strong"].filter(Boolean).join(" ")}).attr("x",t=>{var e;return(null==(e=t.p)?void 0:e.newline)?8:null}).attr("dy",t=>{var e;return(null==(e=t.p)?void 0:e.newline)?l.lineHeight:null})}(e.select(this),t)})),t}function m(n){var r,i;if(!s.data)return;t.attr("style",`font: ${l.nodeFont}`);const h=c().children(t=>!t.fold&&t.children).nodeSize(t=>{const[e,n]=function(t,e){X||(X=document.createElement("canvas"));const n=X.getContext("2d");n.font=e;let r=0,i=0,a=0;const o=t=>{if("text"===t.t){t.p={...t.p},!i&&a&&(t.p.newline=!0);const e=n.measureText(t.v);i+=e.width,r<i&&(r=i)}else"softbreak"===t.t?(i=0,a+=1):"link"===t.t&&t.children.forEach(o)};return t.forEach(o),[r,a+1]}(t.data.v,l.nodeFont);return[n*l.lineHeight,e+16]}).spacing((t,e)=>t.parent===e.parent?l.spacingVertical:2*l.spacingVertical),d=h.hierarchy(s.data);h(d),function(t,e){let n=0;S(t,(t,r)=>{t.y+=n*e,n+=1,r(),n-=1})}(d,l.spacingHorizontal);const u=d.descendants().reverse(),x=d.links(),m=e.linkHorizontal(),y=e.min(u,t=>t.x),v=e.max(u,t=>t.x),z=e.min(u,t=>t.y),E=e.max(u,t=>t.y+t.ySize),{width:w,height:C}=a.getBoundingClientRect();s.minX=y,s.maxX=v,s.minY=z,s.maxY=E,s.offsetWidth=w,s.offsetHeight=C,l.autoFit&&p();const $=n?u.find(t=>t.data===n):d,b=null!=(r=$.data.x0)?r:$.x,j=null!=(i=$.data.y0)?i:$.y,R=o.selectAll("g.markmap-node").data(u,t=>t.data.p.k),A=R.enter().append("g").attr("class","markmap-node").attr("transform",t=>`translate(${j+$.ySize-t.ySize},${b+$.xSize/2})`).on("click",f),O=R.exit().transition().duration(l.duration);O.select("rect").attr("width",0).attr("x",t=>t.ySize),O.select("text").attr("fill-opacity",0),O.attr("transform",t=>`translate(${$.y+$.ySize-t.ySize},${$.x+$.xSize/2})`).remove();const H=R.merge(A);H.transition().duration(l.duration).attr("transform",t=>`translate(${t.y},${t.x+t.xSize/2})`),H.selectAll("rect").data(t=>[t],t=>t.data.p.k).join(t=>t.append("rect").attr("y",-1).attr("x",t=>t.ySize).attr("width",0).attr("height",k),t=>t,t=>t.remove()).transition().duration(l.duration).attr("x",-1).attr("width",t=>t.ySize+2).attr("fill",t=>l.color(t.data.p.i)),H.selectAll("circle").data(t=>t.data.children?[t]:[],t=>t.data.p.k).join(t=>t.append("circle").attr("stroke-width","1.5").attr("r",0),t=>t,t=>t.remove()).transition().duration(l.duration).attr("cx",t=>t.ySize).attr("r",6).attr("stroke",t=>l.color(t.data.p.i)).attr("fill",t=>t.data.fold?l.color(t.data.p.i):"#fff"),H.selectAll("text").data(t=>[t],t=>t.data.p.k).join(t=>t.append("text").attr("x",8).attr("y",t=>l.lineHeight-4-t.xSize).attr("text-anchor","start").attr("fill-opacity",0).call(g),t=>t,t=>t.remove()).transition().duration(l.duration).attr("fill-opacity",1),o.selectAll("path.markmap-link").data(x,t=>t.target.data.p.k).join(t=>{const e=[j+$.ySize,b+$.xSize/2];return t.insert("path","g").attr("d",m({source:e,target:e}))},t=>t,t=>{const e=[$.y+$.ySize,$.x+$.xSize/2];return t.transition().duration(l.duration).attr("d",m({source:e,target:e})).remove()}).transition().duration(l.duration).attr("class","markmap-link").attr("stroke",t=>l.color(t.target.data.p.i)).attr("stroke-width",t=>k(t.target)).attr("d",t=>{const e=[t.source.y+t.source.ySize,t.source.x+t.source.xSize/2],n=[t.target.y,t.target.x+t.target.xSize/2];return m({source:e,target:n})}),u.forEach(t=>{t.data.x0=t.x,t.data.y0=t.y})}}}(this.markmap=this.markmap||{},d3);
{
"name": "markmap-lib",
"version": "0.3.0-1",
"version": "0.3.0-2",
"description": "Visualize your Markdown as mindmaps with Markmap",

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

@@ -1,3 +0,6 @@

import { INode } from './types';
import './style.css';
export declare function render(svg: any, data: INode): void;
export declare function markmap(svg: any, data: any, opts: any): {
setData: (data: any, opts?: any) => void;
setOptions: (opts: any) => void;
fit: () => void;
};

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