markmap-view 0.18.9 → 0.18.10-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +2 -1
- package/dist/index.js +24 -23
- package/package.json +2 -2
package/dist/browser/index.js
CHANGED
|
@@ -1199,7 +1199,8 @@
|
|
|
1199
1199
|
const getOriginTargetRect = (node) => (nodeMap[originMap[node.state.id]] || rootNode).state.rect;
|
|
1200
1200
|
sourceRectMap[rootNode.state.id] = rootNode.state.rect;
|
|
1201
1201
|
if (originData) setOriginNode(originData);
|
|
1202
|
-
|
|
1202
|
+
let { highlight } = this.state;
|
|
1203
|
+
if (highlight && !nodeMap[highlight.state.id]) highlight = void 0;
|
|
1203
1204
|
let highlightNodes = this.g.selectAll(childSelector(SELECTOR_HIGHLIGHT)).selectAll(childSelector("rect")).data(highlight ? [this._getHighlightRect(highlight)] : []).join("rect").attr("x", (d) => d.x).attr("y", (d) => d.y).attr("width", (d) => d.width).attr("height", (d) => d.height);
|
|
1204
1205
|
const mmG = this.g.selectAll(childSelector(SELECTOR_NODE)).each((d) => {
|
|
1205
1206
|
sourceRectMap[d.state.id] = d.state.rect;
|
package/dist/index.js
CHANGED
|
@@ -72,7 +72,7 @@ function Et(e) {
|
|
|
72
72
|
t = (t << 5) - t + e.charCodeAt(i) | 0;
|
|
73
73
|
return (t >>> 0).toString(36);
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function v(e) {
|
|
76
76
|
if (typeof e == "string") {
|
|
77
77
|
const i = e;
|
|
78
78
|
e = (n) => n.matches(i);
|
|
@@ -367,9 +367,9 @@ function tt(e) {
|
|
|
367
367
|
});
|
|
368
368
|
const x = h(g) || [];
|
|
369
369
|
return m.children = x.length === 0 ? null : x.map((y) => d(y, m)), m.children && Object.assign(m, m.children.reduce(
|
|
370
|
-
(y,
|
|
371
|
-
height: Math.max(y.height,
|
|
372
|
-
length: y.length +
|
|
370
|
+
(y, k) => ({
|
|
371
|
+
height: Math.max(y.height, k.height + 1),
|
|
372
|
+
length: y.length + k.length
|
|
373
373
|
}),
|
|
374
374
|
m
|
|
375
375
|
)), m;
|
|
@@ -392,8 +392,8 @@ function tt(e) {
|
|
|
392
392
|
},
|
|
393
393
|
dump(o) {
|
|
394
394
|
const l = i("nodeSize"), h = (d) => (g) => {
|
|
395
|
-
const u = d + " ", m = d + " ", { x, y } = g,
|
|
396
|
-
return `{ size: [${
|
|
395
|
+
const u = d + " ", m = d + " ", { x, y } = g, k = l(g), b = g.children || [], z = b.length === 0 ? " " : `,${u}children: [${m}${b.map(h(m)).join(m)}${u}],${d}`;
|
|
396
|
+
return `{ size: [${k.join(", ")}],${u}x: ${x}, y: ${y}${z}},`;
|
|
397
397
|
};
|
|
398
398
|
return h(`
|
|
399
399
|
`)(o);
|
|
@@ -553,8 +553,8 @@ class it {
|
|
|
553
553
|
}
|
|
554
554
|
_relayout() {
|
|
555
555
|
if (!this.state.data) return;
|
|
556
|
-
this.g.selectAll(
|
|
557
|
-
|
|
556
|
+
this.g.selectAll(v(M)).selectAll(
|
|
557
|
+
v("foreignObject")
|
|
558
558
|
).each(function(l) {
|
|
559
559
|
var g;
|
|
560
560
|
const h = (g = this.firstChild) == null ? void 0 : g.firstChild, d = [h.scrollWidth, h.scrollHeight];
|
|
@@ -622,9 +622,10 @@ class it {
|
|
|
622
622
|
});
|
|
623
623
|
}, x = (r) => u[g[r.state.id]] || o.state.rect, y = (r) => (l[g[r.state.id]] || o).state.rect;
|
|
624
624
|
u[o.state.id] = o.state.rect, t && m(t);
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
625
|
+
let { highlight: k } = this.state;
|
|
626
|
+
k && !l[k.state.id] && (k = void 0);
|
|
627
|
+
let b = this.g.selectAll(v(ge)).selectAll(v("rect")).data(k ? [this._getHighlightRect(k)] : []).join("rect").attr("x", (r) => r.x).attr("y", (r) => r.y).attr("width", (r) => r.width).attr("height", (r) => r.height);
|
|
628
|
+
const z = this.g.selectAll(v(M)).each((r) => {
|
|
628
629
|
u[r.state.id] = r.state.rect;
|
|
629
630
|
}).data(d, (r) => r.state.key), B = z.enter().append("g").attr("data-depth", (r) => r.state.depth).attr("data-path", (r) => r.state.path).each((r) => {
|
|
630
631
|
m(l[h[r.state.id]]);
|
|
@@ -636,10 +637,10 @@ class it {
|
|
|
636
637
|
var p;
|
|
637
638
|
return ["markmap-node", ((p = r.payload) == null ? void 0 : p.fold) && "markmap-fold"].filter(Boolean).join(" ");
|
|
638
639
|
}
|
|
639
|
-
), F = S.selectAll(
|
|
640
|
+
), F = S.selectAll(v("line")).data(
|
|
640
641
|
(r) => [r],
|
|
641
642
|
(r) => r.state.key
|
|
642
|
-
), L = F.enter().append("line").attr("stroke", (r) => s(r)).attr("stroke-width", 0), D = F.merge(L), $ = S.selectAll(
|
|
643
|
+
), L = F.enter().append("line").attr("stroke", (r) => s(r)).attr("stroke-width", 0), D = F.merge(L), $ = S.selectAll(v("circle")).data(
|
|
643
644
|
(r) => {
|
|
644
645
|
var p;
|
|
645
646
|
return (p = r.children) != null && p.length ? [r] : [];
|
|
@@ -651,7 +652,7 @@ class it {
|
|
|
651
652
|
var p;
|
|
652
653
|
return (p = r.payload) != null && p.fold && r.children ? s(r) : "var(--markmap-circle-open-bg)";
|
|
653
654
|
}
|
|
654
|
-
), W = this._observer, I = S.selectAll(
|
|
655
|
+
), W = this._observer, I = S.selectAll(v("foreignObject")).data(
|
|
655
656
|
(r) => [r],
|
|
656
657
|
(r) => r.state.key
|
|
657
658
|
), _ = I.enter().append("foreignObject").attr("class", "markmap-foreign").attr("x", i).attr("y", 0).style("opacity", 0).on("mousedown", T).on("dblclick", T);
|
|
@@ -661,7 +662,7 @@ class it {
|
|
|
661
662
|
W.observe(r);
|
|
662
663
|
});
|
|
663
664
|
const P = C.selectAll(
|
|
664
|
-
|
|
665
|
+
v("foreignObject")
|
|
665
666
|
);
|
|
666
667
|
P.each(function() {
|
|
667
668
|
var p;
|
|
@@ -673,7 +674,7 @@ class it {
|
|
|
673
674
|
var p;
|
|
674
675
|
return (p = r.payload) != null && p.fold ? [] : r.children.map((f) => ({ source: r, target: f }));
|
|
675
676
|
}
|
|
676
|
-
), O = this.g.selectAll(
|
|
677
|
+
), O = this.g.selectAll(v(pe)).data(st, (r) => r.target.state.key), ot = O.exit(), at = O.enter().insert("path", "g").attr("class", "markmap-link").attr("data-depth", (r) => r.target.state.depth).attr("data-path", (r) => r.target.state.path).attr("d", (r) => {
|
|
677
678
|
const p = x(r.target), f = [
|
|
678
679
|
p.x + p.width,
|
|
679
680
|
p.y + p.height
|
|
@@ -683,7 +684,7 @@ class it {
|
|
|
683
684
|
this.svg.style(
|
|
684
685
|
"--markmap-max-width",
|
|
685
686
|
a ? `${a}px` : null
|
|
686
|
-
), await new Promise(requestAnimationFrame), this._relayout(), b = b.data(
|
|
687
|
+
), await new Promise(requestAnimationFrame), this._relayout(), b = b.data(k ? [this._getHighlightRect(k)] : []).join("rect"), this.transition(b).attr("x", (r) => r.x).attr("y", (r) => r.y).attr("width", (r) => r.width).attr("height", (r) => r.height), B.attr("transform", (r) => {
|
|
687
688
|
const p = x(r);
|
|
688
689
|
return `translate(${p.x + p.width - r.state.rect.width},${p.y + p.height - r.state.rect.height})`;
|
|
689
690
|
}), this.transition(C).attr("transform", (r) => {
|
|
@@ -694,11 +695,11 @@ class it {
|
|
|
694
695
|
(r) => `translate(${r.state.rect.x},${r.state.rect.y})`
|
|
695
696
|
);
|
|
696
697
|
const lt = C.selectAll(
|
|
697
|
-
|
|
698
|
+
v("line")
|
|
698
699
|
);
|
|
699
700
|
this.transition(lt).attr("x1", (r) => r.state.rect.width).attr("stroke-width", 0), L.attr("x1", (r) => r.state.rect.width).attr("x2", (r) => r.state.rect.width), D.attr("y1", (r) => r.state.rect.height + c(r) / 2).attr("y2", (r) => r.state.rect.height + c(r) / 2), this.transition(D).attr("x1", -1).attr("x2", (r) => r.state.rect.width + 2).attr("stroke", (r) => s(r)).attr("stroke-width", c);
|
|
700
701
|
const ct = C.selectAll(
|
|
701
|
-
|
|
702
|
+
v("circle")
|
|
702
703
|
);
|
|
703
704
|
this.transition(ct).attr("r", 0).attr("stroke-width", 0), N.attr("cx", (r) => r.state.rect.width).attr("cy", (r) => r.state.rect.height + c(r) / 2), this.transition(N).attr("r", 6).attr("stroke-width", "1.5"), this.transition(P).style("opacity", 0), K.attr("width", (r) => Math.max(0, r.state.rect.width - i * 2)).attr("height", (r) => r.state.rect.height), this.transition(K).style("opacity", 1), this.transition(ot).attr("d", (r) => {
|
|
704
705
|
const p = y(r.target), f = [
|
|
@@ -737,7 +738,7 @@ class it {
|
|
|
737
738
|
}
|
|
738
739
|
findElement(t) {
|
|
739
740
|
let i;
|
|
740
|
-
return this.g.selectAll(
|
|
741
|
+
return this.g.selectAll(v(M)).each(function(s) {
|
|
741
742
|
s === t && (i = {
|
|
742
743
|
data: s,
|
|
743
744
|
g: this
|
|
@@ -748,8 +749,8 @@ class it {
|
|
|
748
749
|
* Pan the content to make the provided node visible in the viewport.
|
|
749
750
|
*/
|
|
750
751
|
async ensureVisible(t, i) {
|
|
751
|
-
var
|
|
752
|
-
const n = (
|
|
752
|
+
var k;
|
|
753
|
+
const n = (k = this.findElement(t)) == null ? void 0 : k.data;
|
|
753
754
|
if (!n) return;
|
|
754
755
|
const s = this.svg.node(), a = s.getBoundingClientRect(), c = w(s), [o, l] = [
|
|
755
756
|
n.state.rect.x,
|
|
@@ -809,7 +810,7 @@ class it {
|
|
|
809
810
|
}
|
|
810
811
|
export {
|
|
811
812
|
it as Markmap,
|
|
812
|
-
|
|
813
|
+
v as childSelector,
|
|
813
814
|
bt as defaultColorFn,
|
|
814
815
|
J as defaultOptions,
|
|
815
816
|
ke as deriveOptions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markmap-view",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.10-alpha.2+9487f11",
|
|
4
4
|
"description": "View markmaps in browser",
|
|
5
5
|
"author": "Gerald <gera2ld@live.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"markmap-common": "*"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "9487f115b82c8eaee934c7f848faf67f05c700b1"
|
|
55
55
|
}
|