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

markmap-view

Package Overview
Dependencies
Maintainers
0
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markmap-view - npm Package Compare versions

Comparing version

to
0.17.3-alpha.1

177

dist/browser/index.js

@@ -13,4 +13,3 @@ (function(exports, d32) {

const i = this.listeners.indexOf(fn);
if (i >= 0)
this.listeners.splice(i, 1);
if (i >= 0) this.listeners.splice(i, 1);
}

@@ -48,4 +47,3 @@ revokeAll() {

rest.forEach((item) => {
if (item && classList.indexOf(item) < 0)
classList.push(item);
if (item && classList.indexOf(item) < 0) classList.push(item);
});

@@ -62,4 +60,3 @@ return classList.join(" ");

let nodes = Array.from(this.childNodes);
if (filterFn)
nodes = nodes.filter((node) => filterFn(node));
if (filterFn) nodes = nodes.filter((node) => filterFn(node));
return nodes;

@@ -102,4 +99,3 @@ };

reset();
if (state.args)
state.result = fn(...state.args);
if (state.args) state.result = fn(...state.args);
}

@@ -134,8 +130,5 @@ return function debounced(...args) {

let vtype;
if (typeof type === "string")
vtype = VTYPE_ELEMENT$1;
else if (typeof type === "function")
vtype = VTYPE_FUNCTION$1;
else
throw new Error("Invalid VNode type");
if (typeof type === "string") vtype = VTYPE_ELEMENT$1;
else if (typeof type === "function") vtype = VTYPE_FUNCTION$1;
else throw new Error("Invalid VNode type");
return {

@@ -154,12 +147,9 @@ vtype,

function insertDom$1(parent, nodes) {
if (!Array.isArray(nodes))
nodes = [nodes];
if (!Array.isArray(nodes)) nodes = [nodes];
nodes = nodes.filter(Boolean);
if (nodes.length)
parent.append(...nodes);
if (nodes.length) parent.append(...nodes);
}
function mountAttributes$1(domElement, props, env) {
for (const key in props) {
if (key === "key" || key === "children" || key === "ref")
continue;
if (key === "key" || key === "children" || key === "ref") continue;
if (key === "dangerouslySetInnerHTML") {

@@ -169,4 +159,3 @@ domElement.innerHTML = props[key].__html;

const value = props[key];
if (value != null)
domElement[key] = value;
if (value != null) domElement[key] = value;
} else if (key.startsWith("on")) {

@@ -255,4 +244,3 @@ domElement[key.toLowerCase()] = props[key];

const children = mountChildren$1(props.children, childEnv);
if (children != null)
insertDom$1(node, children);
if (children != null) insertDom$1(node, children);
}

@@ -262,4 +250,3 @@ const {

} = props;
if (typeof ref === "function")
ref(node);
if (typeof ref === "function") ref(node);
return node;

@@ -321,4 +308,3 @@ }

item.loaded = deferred.promise;
if (url)
cssCache[url] = item.loaded;
if (url) cssCache[url] = item.loaded;
if (item.type === "style") {

@@ -339,4 +325,3 @@ document.head.append(

fetch(url).then((res) => {
if (res.ok)
return res.text();
if (res.ok) return res.text();
throw res;

@@ -426,4 +411,3 @@ }).then(() => deferred.resolve(), deferred.reject);

const value = options[key];
if (typeof value === "number")
derivedOptions[key] = value;
if (typeof value === "number") derivedOptions[key] = value;
});

@@ -433,4 +417,3 @@ const booleanKeys = ["zoom", "pan"];

const value = options[key];
if (value != null)
derivedOptions[key] = !!value;
if (value != null) derivedOptions[key] = !!value;
});

@@ -454,8 +437,5 @@ return derivedOptions;

let vtype;
if (typeof type === "string")
vtype = VTYPE_ELEMENT;
else if (typeof type === "function")
vtype = VTYPE_FUNCTION;
else
throw new Error("Invalid VNode type");
if (typeof type === "string") vtype = VTYPE_ELEMENT;
else if (typeof type === "function") vtype = VTYPE_FUNCTION;
else throw new Error("Invalid VNode type");
return {

@@ -474,12 +454,9 @@ vtype,

function insertDom(parent, nodes) {
if (!Array.isArray(nodes))
nodes = [nodes];
if (!Array.isArray(nodes)) nodes = [nodes];
nodes = nodes.filter(Boolean);
if (nodes.length)
parent.append(...nodes);
if (nodes.length) parent.append(...nodes);
}
function mountAttributes(domElement, props, env) {
for (const key in props) {
if (key === "key" || key === "children" || key === "ref")
continue;
if (key === "key" || key === "children" || key === "ref") continue;
if (key === "dangerouslySetInnerHTML") {

@@ -489,4 +466,3 @@ domElement.innerHTML = props[key].__html;

const value = props[key];
if (value != null)
domElement[key] = value;
if (value != null) domElement[key] = value;
} else if (key.startsWith("on")) {

@@ -575,4 +551,3 @@ domElement[key.toLowerCase()] = props[key];

const children = mountChildren(props.children, childEnv);
if (children != null)
insertDom(node, children);
if (children != null) insertDom(node, children);
}

@@ -582,4 +557,3 @@ const {

} = props;
if (typeof ref === "function")
ref(node);
if (typeof ref === "function") ref(node);
return node;

@@ -594,7 +568,4 @@ }

var sum = 0, children = node.children, i = children && children.length;
if (!i)
sum = 1;
else
while (--i >= 0)
sum += children[i].value;
if (!i) sum = 1;
else while (--i >= 0) sum += children[i].value;
node.value = sum;

@@ -611,6 +582,5 @@ }

callback(node), children = node.children;
if (children)
for (i = 0, n = children.length; i < n; ++i) {
next.push(children[i]);
}
if (children) for (i = 0, n = children.length; i < n; ++i) {
next.push(children[i]);
}
}

@@ -624,6 +594,5 @@ } while (next.length);

callback(node), children = node.children;
if (children)
for (i = children.length - 1; i >= 0; --i) {
nodes.push(children[i]);
}
if (children) for (i = children.length - 1; i >= 0; --i) {
nodes.push(children[i]);
}
}

@@ -636,6 +605,5 @@ return this;

next.push(node), children = node.children;
if (children)
for (i = 0, n = children.length; i < n; ++i) {
nodes.push(children[i]);
}
if (children) for (i = 0, n = children.length; i < n; ++i) {
nodes.push(children[i]);
}
}

@@ -650,4 +618,3 @@ while (node = next.pop()) {

var sum = +value(node.data) || 0, children = node.children, i = children && children.length;
while (--i >= 0)
sum += children[i].value;
while (--i >= 0) sum += children[i].value;
node.value = sum;

@@ -677,4 +644,3 @@ });

function leastCommonAncestor(a, b) {
if (a === b)
return a;
if (a === b) return a;
var aNodes = a.ancestors(), bNodes = b.ancestors(), c = null;

@@ -724,7 +690,5 @@ a = aNodes.pop();

var root = new Node$1(data), valued = +data.value && (root.value = data.value), node, nodes = [root], child, childs, i, n;
if (children == null)
children = defaultChildren;
if (children == null) children = defaultChildren;
while (node = nodes.pop()) {
if (valued)
node.value = +node.data.value;
if (valued) node.value = +node.data.value;
if ((childs = children(node.data)) && (n = childs.length)) {

@@ -1060,4 +1024,3 @@ node.children = new Array(n);

const lowY = (i === 0 ? kid.lExt : kid.rExt).bottom;
if (i !== 0)
separate(w, i, lastLows);
if (i !== 0) separate(w, i, lastLows);
const lows = updateLows(lowY, i, lastLows);

@@ -1100,4 +1063,3 @@ return [i + 1, lows];

while (rContour && lContour) {
if (rContour.bottom > lows.lowY)
lows = lows.next;
if (rContour.bottom > lows.lowY) lows = lows.next;
const dist = rSumMods + rContour.prelim - (lSumMods + lContour.prelim) + rContour.xSize / 2 + lContour.xSize / 2 + rContour.spacing(lContour);

@@ -1114,15 +1076,11 @@ if (dist > 0 || dist < 0 && isFirst) {

rContour = nextRContour(rContour);
if (rContour)
rSumMods += rContour.relX;
if (rContour) rSumMods += rContour.relX;
}
if (rightBottom >= leftBottom) {
lContour = nextLContour(lContour);
if (lContour)
lSumMods += lContour.relX;
if (lContour) lSumMods += lContour.relX;
}
}
if (!rContour && lContour)
setLThr(w, i, lContour, lSumMods);
else if (rContour && !lContour)
setRThr(w, i, rContour, rSumMods);
if (!rContour && lContour) setLThr(w, i, lContour, lSumMods);
else if (rContour && !lContour) setRThr(w, i, rContour, rSumMods);
};

@@ -1230,4 +1188,3 @@ const moveSubtree = (subtree, distance) => {

let recursive = this.options.toggleRecursively;
if (isMacintosh ? e.metaKey : e.ctrlKey)
recursive = !recursive;
if (isMacintosh ? e.metaKey : e.ctrlKey) recursive = !recursive;
this.toggleNode(d.data, recursive);

@@ -1239,4 +1196,3 @@ };

if (this.options.scrollForPan) {
if (event.type === "wheel")
return event.ctrlKey && !event.button;
if (event.type === "wheel") return event.ctrlKey && !event.button;
}

@@ -1339,4 +1295,3 @@ return (!event.ctrlKey || event.type === "wheel") && !event.button;

next();
if (isFoldRecursively)
foldRecursively -= 1;
if (isFoldRecursively) foldRecursively -= 1;
depth -= 1;

@@ -1370,4 +1325,3 @@ });

container.querySelectorAll("img").forEach((img) => {
if (img.width)
return;
if (img.width) return;
const size = this.imgCache[img.src];

@@ -1407,8 +1361,5 @@ if (size == null ? void 0 : size[0]) {

setData(data, opts) {
if (opts)
this.setOptions(opts);
if (data)
this.state.data = data;
if (!this.state.data)
return;
if (opts) this.setOptions(opts);
if (data) this.state.data = data;
if (!this.state.data) return;
this.initializeData(this.state.data);

@@ -1419,9 +1370,7 @@ this.updateStyle();

renderData(originData) {
if (!this.state.data)
return;
if (!this.state.data) return;
const { spacingHorizontal, paddingX, spacingVertical, autoFit, color } = this.options;
const layout = flextree({}).children((d) => {
var _a;
if (!((_a = d.payload) == null ? void 0 : _a.fold))
return d.children;
if (!((_a = d.payload) == null ? void 0 : _a.fold)) return d.children;
}).nodeSize((node2) => {

@@ -1448,10 +1397,7 @@ const [width, height] = node2.data.state.size;

});
if (autoFit)
this.fit();
if (autoFit) this.fit();
const origin = originData && descendants.find((item) => item.data === originData) || tree;
const x0 = origin.data.state.x0 ?? origin.x;
const y0 = origin.data.state.y0 ?? origin.y;
const node = this.g.selectAll(
childSelector("g")
).data(descendants, (d) => d.data.state.key);
const node = this.g.selectAll(childSelector("g")).data(descendants, (d) => d.data.state.key);
const nodeEnter = node.enter().append("g").attr("data-depth", (d) => d.data.state.depth).attr("data-path", (d) => d.data.state.path).attr(

@@ -1600,5 +1546,3 @@ "transform",

let result;
this.g.selectAll(
childSelector("g")
).each(function walk(d) {
this.g.selectAll(childSelector("g")).each(function walk(d) {
if (d.data === node) {

@@ -1619,4 +1563,3 @@ result = {

const itemData = (_a = this.findElement(node)) == null ? void 0 : _a.data;
if (!itemData)
return;
if (!itemData) return;
const svgNode = this.svg.node();

@@ -1623,0 +1566,0 @@ const { spacingHorizontal } = this.options;

@@ -70,8 +70,5 @@ import { Hook as st, getId as at, debounce as lt, addClass as ct, walkTree as M, childSelector as C, noop as T } from "markmap-common";

let n;
if (typeof e == "string")
n = U;
else if (typeof e == "function")
n = G;
else
throw new Error("Invalid VNode type");
if (typeof e == "string") n = U;
else if (typeof e == "function") n = G;
else throw new Error("Invalid VNode type");
return {

@@ -100,4 +97,3 @@ vtype: n,

o != null && (e[i] = o);
} else
i.startsWith("on") ? e[i.toLowerCase()] = t[i] : wt(e, i, t[i], n.isSvg);
} else i.startsWith("on") ? e[i.toLowerCase()] = t[i] : wt(e, i, t[i], n.isSvg);
}

@@ -175,7 +171,4 @@ const Ct = {

var t = 0, n = e.children, i = n && n.length;
if (!i)
t = 1;
else
for (; --i >= 0; )
t += n[i].value;
if (!i) t = 1;
else for (; --i >= 0; ) t += n[i].value;
e.value = t;

@@ -190,5 +183,4 @@ }

for (n = i.reverse(), i = []; t = n.pop(); )
if (e(t), o = t.children, o)
for (a = 0, c = o.length; a < c; ++a)
i.push(o[a]);
if (e(t), o = t.children, o) for (a = 0, c = o.length; a < c; ++a)
i.push(o[a]);
while (i.length);

@@ -199,5 +191,4 @@ return this;

for (var t = this, n = [t], i, o; t = n.pop(); )
if (e(t), i = t.children, i)
for (o = i.length - 1; o >= 0; --o)
n.push(i[o]);
if (e(t), i = t.children, i) for (o = i.length - 1; o >= 0; --o)
n.push(i[o]);
return this;

@@ -207,5 +198,4 @@ }

for (var t = this, n = [t], i = [], o, a, c; t = n.pop(); )
if (i.push(t), o = t.children, o)
for (a = 0, c = o.length; a < c; ++a)
n.push(o[a]);
if (i.push(t), o = t.children, o) for (a = 0, c = o.length; a < c; ++a)
n.push(o[a]);
for (; t = i.pop(); )

@@ -217,4 +207,3 @@ e(t);

return this.eachAfter(function(t) {
for (var n = +e(t.data) || 0, i = t.children, o = i && i.length; --o >= 0; )
n += i[o].value;
for (var n = +e(t.data) || 0, i = t.children, o = i && i.length; --o >= 0; ) n += i[o].value;
t.value = n;

@@ -236,4 +225,3 @@ });

function Dt(e, t) {
if (e === t)
return e;
if (e === t) return e;
var n = e.ancestors(), i = t.ancestors(), o = null;

@@ -734,4 +722,3 @@ for (e = n.pop(), t = i.pop(); e === t; )

t.querySelectorAll("img").forEach((n) => {
if (n.width)
return;
if (n.width) return;
const i = this.imgCache[n.src];

@@ -758,8 +745,6 @@ i != null && i[0] ? [n.width, n.height] = i : i || this._loadImage(n.src);

renderData(t) {
if (!this.state.data)
return;
if (!this.state.data) return;
const { spacingHorizontal: n, paddingX: i, spacingVertical: o, autoFit: a, color: c } = this.options, s = q({}).children((r) => {
var d;
if (!((d = r.payload) != null && d.fold))
return r.children;
if (!((d = r.payload) != null && d.fold)) return r.children;
}).nodeSize((r) => {

@@ -777,5 +762,3 @@ const [d, S] = r.data.state.size;

}), a && this.fit();
const f = t && p.find((r) => r.data === t) || l, k = f.data.state.x0 ?? f.x, v = f.data.state.y0 ?? f.y, b = this.g.selectAll(
C("g")
).data(p, (r) => r.data.state.key), w = b.enter().append("g").attr("data-depth", (r) => r.data.state.depth).attr("data-path", (r) => r.data.state.path).attr(
const f = t && p.find((r) => r.data === t) || l, k = f.data.state.x0 ?? f.x, v = f.data.state.y0 ?? f.y, b = this.g.selectAll(C("g")).data(p, (r) => r.data.state.key), w = b.enter().append("g").attr("data-depth", (r) => r.data.state.depth).attr("data-path", (r) => r.data.state.path).attr(
"transform",

@@ -902,5 +885,3 @@ (r) => `translate(${v + f.ySize - r.ySize},${k + f.xSize / 2 - r.xSize})`

let n;
return this.g.selectAll(
C("g")
).each(function(o) {
return this.g.selectAll(C("g")).each(function(o) {
o.data === t && (n = {

@@ -918,4 +899,3 @@ data: o,

const i = (k = this.findElement(t)) == null ? void 0 : k.data;
if (!i)
return;
if (!i) return;
const o = this.svg.node(), { spacingHorizontal: a } = this.options, c = o.getBoundingClientRect(), s = A(o), [l, p] = [

@@ -922,0 +902,0 @@ i.y,

{
"name": "markmap-view",
"version": "0.17.2",
"version": "0.17.3-alpha.1+4942a37",
"description": "View markmaps in browser",

@@ -54,3 +54,3 @@ "author": "Gerald <gera2ld@live.com>",

},
"gitHead": "bbeec32d0efeea4e36755b1909a5993187264487"
"gitHead": "4942a3759db08bbbc179034c0b08c5c2112566dc"
}