markmap-view 0.18.5-alpha.6 → 0.18.5
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 +40 -15
- package/dist/index.js +356 -345
- package/dist/types.d.ts +1 -0
- package/dist/view.d.ts +4 -2
- package/package.json +3 -3
package/dist/browser/index.js
CHANGED
|
@@ -403,8 +403,8 @@
|
|
|
403
403
|
}
|
|
404
404
|
function childSelector(filter) {
|
|
405
405
|
if (typeof filter === "string") {
|
|
406
|
-
const
|
|
407
|
-
filter = (el) => el.
|
|
406
|
+
const selector = filter;
|
|
407
|
+
filter = (el) => el.matches(selector);
|
|
408
408
|
}
|
|
409
409
|
const filterFn = filter;
|
|
410
410
|
return function selector() {
|
|
@@ -942,8 +942,11 @@
|
|
|
942
942
|
next: lastLows
|
|
943
943
|
};
|
|
944
944
|
};
|
|
945
|
-
const css = ".markmap {\n --markmap-max-width: 9999px;\n --markmap-a-color: #0097e6;\n --markmap-a-hover-color: #00a8ff;\n --markmap-code-bg: #f0f0f0;\n --markmap-code-color: #555;\n --markmap-highlight-bg: #ffeaa7;\n --markmap-table-border: 1px solid currentColor;\n --markmap-font: 300 16px/20px sans-serif;\n --markmap-circle-open-bg: #fff;\n --markmap-text-color: #333;\n\n font: var(--markmap-font);\n color: var(--markmap-text-color);\n}\n\n .markmap-link {\n fill: none;\n }\n\n .markmap-node > circle {\n cursor: pointer;\n }\n\n .markmap-foreign {\n display: inline-block;\n }\n\n .markmap-foreign p {\n margin: 0;\n }\n\n .markmap-foreign a {\n color: var(--markmap-a-color);\n }\n\n .markmap-foreign a:hover {\n color: var(--markmap-a-hover-color);\n }\n\n .markmap-foreign code {\n padding: 0.25em;\n font-size: calc(1em - 2px);\n color: var(--markmap-code-color);\n background-color: var(--markmap-code-bg);\n border-radius: 2px;\n }\n\n .markmap-foreign pre {\n margin: 0;\n }\n\n .markmap-foreign pre > code {\n display: block;\n }\n\n .markmap-foreign del {\n text-decoration: line-through;\n }\n\n .markmap-foreign em {\n font-style: italic;\n }\n\n .markmap-foreign strong {\n font-weight: bold;\n }\n\n .markmap-foreign mark {\n background: var(--markmap-highlight-bg);\n }\n\n .markmap-foreign table,\n .markmap-foreign th,\n .markmap-foreign td {\n border-collapse: collapse;\n border: var(--markmap-table-border);\n }\n\n .markmap-foreign img {\n display: inline-block;\n }\n\n .markmap-foreign svg {\n fill: currentColor;\n }\n\n .markmap-foreign > div {\n width: var(--markmap-max-width);\n text-align: left;\n }\n\n .markmap-foreign > div > div {\n display: inline-block;\n }\n\n.markmap-dark .markmap {\n --markmap-code-bg: #1a1b26;\n --markmap-code-color: #ddd;\n --markmap-circle-open-bg: #444;\n --markmap-text-color: #eee;\n}\n";
|
|
945
|
+
const css = ".markmap {\n --markmap-max-width: 9999px;\n --markmap-a-color: #0097e6;\n --markmap-a-hover-color: #00a8ff;\n --markmap-code-bg: #f0f0f0;\n --markmap-code-color: #555;\n --markmap-highlight-bg: #ffeaa7;\n --markmap-table-border: 1px solid currentColor;\n --markmap-font: 300 16px/20px sans-serif;\n --markmap-circle-open-bg: #fff;\n --markmap-text-color: #333;\n --markmap-highlight-node-bg: #ff02;\n\n font: var(--markmap-font);\n color: var(--markmap-text-color);\n}\n\n .markmap-link {\n fill: none;\n }\n\n .markmap-node > circle {\n cursor: pointer;\n }\n\n .markmap-foreign {\n display: inline-block;\n }\n\n .markmap-foreign p {\n margin: 0;\n }\n\n .markmap-foreign a {\n color: var(--markmap-a-color);\n }\n\n .markmap-foreign a:hover {\n color: var(--markmap-a-hover-color);\n }\n\n .markmap-foreign code {\n padding: 0.25em;\n font-size: calc(1em - 2px);\n color: var(--markmap-code-color);\n background-color: var(--markmap-code-bg);\n border-radius: 2px;\n }\n\n .markmap-foreign pre {\n margin: 0;\n }\n\n .markmap-foreign pre > code {\n display: block;\n }\n\n .markmap-foreign del {\n text-decoration: line-through;\n }\n\n .markmap-foreign em {\n font-style: italic;\n }\n\n .markmap-foreign strong {\n font-weight: bold;\n }\n\n .markmap-foreign mark {\n background: var(--markmap-highlight-bg);\n }\n\n .markmap-foreign table,\n .markmap-foreign th,\n .markmap-foreign td {\n border-collapse: collapse;\n border: var(--markmap-table-border);\n }\n\n .markmap-foreign img {\n display: inline-block;\n }\n\n .markmap-foreign svg {\n fill: currentColor;\n }\n\n .markmap-foreign > div {\n width: var(--markmap-max-width);\n text-align: left;\n }\n\n .markmap-foreign > div > div {\n display: inline-block;\n }\n\n .markmap-highlight rect {\n fill: var(--markmap-highlight-node-bg);\n }\n\n.markmap-dark .markmap {\n --markmap-code-bg: #1a1b26;\n --markmap-code-color: #ddd;\n --markmap-circle-open-bg: #444;\n --markmap-text-color: #eee;\n}\n";
|
|
946
946
|
const globalCSS = css;
|
|
947
|
+
const SELECTOR_NODE = "g.markmap-node";
|
|
948
|
+
const SELECTOR_LINK = "path.markmap-link";
|
|
949
|
+
const SELECTOR_HIGHLIGHT = "g.markmap-highlight";
|
|
947
950
|
const linkShape = d32.linkHorizontal();
|
|
948
951
|
function linkWidth(data) {
|
|
949
952
|
return Math.max(4 - 2 * data.state.depth, 1.5);
|
|
@@ -959,7 +962,7 @@
|
|
|
959
962
|
class Markmap {
|
|
960
963
|
constructor(svg, opts) {
|
|
961
964
|
this.options = defaultOptions;
|
|
962
|
-
this.
|
|
965
|
+
this._disposeList = [];
|
|
963
966
|
this.handleZoom = (e) => {
|
|
964
967
|
const { transform } = e;
|
|
965
968
|
this.g.attr("transform", transform);
|
|
@@ -993,16 +996,17 @@
|
|
|
993
996
|
rect: { x1: 0, y1: 0, x2: 0, y2: 0 }
|
|
994
997
|
};
|
|
995
998
|
this.g = this.svg.append("g");
|
|
996
|
-
this.
|
|
999
|
+
this.g.append("g").attr("class", "markmap-highlight");
|
|
1000
|
+
this._observer = new ResizeObserver(
|
|
997
1001
|
debounce(() => {
|
|
998
1002
|
this.renderData();
|
|
999
1003
|
}, 100)
|
|
1000
1004
|
);
|
|
1001
|
-
this.
|
|
1005
|
+
this._disposeList.push(
|
|
1002
1006
|
refreshHook.tap(() => {
|
|
1003
1007
|
this.setData();
|
|
1004
1008
|
}),
|
|
1005
|
-
() => this.
|
|
1009
|
+
() => this._observer.disconnect()
|
|
1006
1010
|
);
|
|
1007
1011
|
}
|
|
1008
1012
|
getStyleContent() {
|
|
@@ -1073,10 +1077,11 @@
|
|
|
1073
1077
|
if (isFoldRecursively) foldRecursively -= 1;
|
|
1074
1078
|
depth -= 1;
|
|
1075
1079
|
});
|
|
1080
|
+
return node;
|
|
1076
1081
|
}
|
|
1077
1082
|
_relayout() {
|
|
1078
1083
|
if (!this.state.data) return;
|
|
1079
|
-
this.g.selectAll(childSelector(
|
|
1084
|
+
this.g.selectAll(childSelector(SELECTOR_NODE)).selectAll(
|
|
1080
1085
|
childSelector("foreignObject")
|
|
1081
1086
|
).each(function(d) {
|
|
1082
1087
|
var _a;
|
|
@@ -1137,12 +1142,28 @@
|
|
|
1137
1142
|
}
|
|
1138
1143
|
async setData(data, opts) {
|
|
1139
1144
|
if (opts) this.setOptions(opts);
|
|
1140
|
-
if (data) this.state.data = data;
|
|
1145
|
+
if (data) this.state.data = this._initializeData(data);
|
|
1141
1146
|
if (!this.state.data) return;
|
|
1142
|
-
this._initializeData(this.state.data);
|
|
1143
1147
|
this.updateStyle();
|
|
1144
1148
|
await this.renderData();
|
|
1145
1149
|
}
|
|
1150
|
+
async setHighlight(node) {
|
|
1151
|
+
this.state.highlight = node || void 0;
|
|
1152
|
+
await this.renderData();
|
|
1153
|
+
}
|
|
1154
|
+
_getHighlightRect(highlight) {
|
|
1155
|
+
const svgNode = this.svg.node();
|
|
1156
|
+
const transform = d32.zoomTransform(svgNode);
|
|
1157
|
+
const padding = 4 / transform.k;
|
|
1158
|
+
const rect = {
|
|
1159
|
+
...highlight.state.rect
|
|
1160
|
+
};
|
|
1161
|
+
rect.x -= padding;
|
|
1162
|
+
rect.y -= padding;
|
|
1163
|
+
rect.width += 2 * padding;
|
|
1164
|
+
rect.height += 2 * padding;
|
|
1165
|
+
return rect;
|
|
1166
|
+
}
|
|
1146
1167
|
async renderData(originData) {
|
|
1147
1168
|
const { paddingX, autoFit, color, maxWidth } = this.options;
|
|
1148
1169
|
const rootNode = this.state.data;
|
|
@@ -1173,7 +1194,9 @@
|
|
|
1173
1194
|
const getOriginTargetRect = (node) => (nodeMap[originMap[node.state.id]] || rootNode).state.rect;
|
|
1174
1195
|
sourceRectMap[rootNode.state.id] = rootNode.state.rect;
|
|
1175
1196
|
if (originData) setOriginNode(originData);
|
|
1176
|
-
const
|
|
1197
|
+
const { highlight } = this.state;
|
|
1198
|
+
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);
|
|
1199
|
+
const mmG = this.g.selectAll(childSelector(SELECTOR_NODE)).each((d) => {
|
|
1177
1200
|
sourceRectMap[d.state.id] = d.state.rect;
|
|
1178
1201
|
}).data(nodes, (d) => d.state.key);
|
|
1179
1202
|
const mmGEnter = mmG.enter().append("g").attr("data-depth", (d) => d.state.depth).attr("data-path", (d) => d.state.path).each((d) => {
|
|
@@ -1210,7 +1233,7 @@
|
|
|
1210
1233
|
return ((_a = d.payload) == null ? void 0 : _a.fold) && d.children ? color(d) : "var(--markmap-circle-open-bg)";
|
|
1211
1234
|
}
|
|
1212
1235
|
);
|
|
1213
|
-
const observer = this.
|
|
1236
|
+
const observer = this._observer;
|
|
1214
1237
|
const mmFo = mmGMerge.selectAll(childSelector("foreignObject")).data(
|
|
1215
1238
|
(d) => [d],
|
|
1216
1239
|
(d) => d.state.key
|
|
@@ -1237,7 +1260,7 @@
|
|
|
1237
1260
|
return ((_a = node.payload) == null ? void 0 : _a.fold) ? [] : node.children.map((child) => ({ source: node, target: child }));
|
|
1238
1261
|
}
|
|
1239
1262
|
);
|
|
1240
|
-
const mmPath = this.g.selectAll(childSelector(
|
|
1263
|
+
const mmPath = this.g.selectAll(childSelector(SELECTOR_LINK)).data(links, (d) => d.target.state.key);
|
|
1241
1264
|
const mmPathExit = mmPath.exit();
|
|
1242
1265
|
const mmPathEnter = mmPath.enter().insert("path", "g").attr("class", "markmap-link").attr("data-depth", (d) => d.target.state.depth).attr("data-path", (d) => d.target.state.path).attr("d", (d) => {
|
|
1243
1266
|
const originRect = getOriginSourceRect(d.target);
|
|
@@ -1254,6 +1277,8 @@
|
|
|
1254
1277
|
);
|
|
1255
1278
|
await new Promise(requestAnimationFrame);
|
|
1256
1279
|
this._relayout();
|
|
1280
|
+
highlightNodes = highlightNodes.data(highlight ? [this._getHighlightRect(highlight)] : []).join("rect");
|
|
1281
|
+
this.transition(highlightNodes).attr("x", (d) => d.x).attr("y", (d) => d.y).attr("width", (d) => d.width).attr("height", (d) => d.height);
|
|
1257
1282
|
mmGEnter.attr("transform", (d) => {
|
|
1258
1283
|
const originRect = getOriginSourceRect(d);
|
|
1259
1284
|
return `translate(${originRect.x + originRect.width - d.state.rect.width},${originRect.y + originRect.height - d.state.rect.height})`;
|
|
@@ -1334,7 +1359,7 @@
|
|
|
1334
1359
|
}
|
|
1335
1360
|
findElement(node) {
|
|
1336
1361
|
let result;
|
|
1337
|
-
this.g.selectAll(childSelector(
|
|
1362
|
+
this.g.selectAll(childSelector(SELECTOR_NODE)).each(function walk(d) {
|
|
1338
1363
|
if (d === node) {
|
|
1339
1364
|
result = {
|
|
1340
1365
|
data: d,
|
|
@@ -1421,7 +1446,7 @@
|
|
|
1421
1446
|
destroy() {
|
|
1422
1447
|
this.svg.on(".zoom", null);
|
|
1423
1448
|
this.svg.html(null);
|
|
1424
|
-
this.
|
|
1449
|
+
this._disposeList.forEach((fn) => {
|
|
1425
1450
|
fn();
|
|
1426
1451
|
});
|
|
1427
1452
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Hook as
|
|
2
|
-
import { loadCSS as
|
|
3
|
-
import { scaleOrdinal as
|
|
4
|
-
const
|
|
1
|
+
import { Hook as ht, getId as dt, debounce as pt, addClass as ut, walkTree as R, noop as X } from "markmap-common";
|
|
2
|
+
import { loadCSS as Ee, loadJS as ze } from "markmap-common";
|
|
3
|
+
import { scaleOrdinal as Y, schemeCategory10 as gt, linkHorizontal as mt, zoomTransform as z, select as ft, zoom as xt, min as K, max as G, zoomIdentity as yt, minIndex as kt } from "d3";
|
|
4
|
+
const Z = typeof navigator < "u" && navigator.userAgent.includes("Macintosh"), vt = Y(gt), q = {
|
|
5
5
|
autoFit: !1,
|
|
6
6
|
color: (e) => {
|
|
7
7
|
var t;
|
|
8
|
-
return
|
|
8
|
+
return vt(`${((t = e.state) == null ? void 0 : t.path) || ""}`);
|
|
9
9
|
},
|
|
10
10
|
duration: 500,
|
|
11
11
|
embedGlobalCSS: !0,
|
|
@@ -14,7 +14,7 @@ const V = typeof navigator < "u" && navigator.userAgent.includes("Macintosh"), x
|
|
|
14
14
|
maxWidth: 0,
|
|
15
15
|
nodeMinHeight: 16,
|
|
16
16
|
paddingX: 8,
|
|
17
|
-
scrollForPan:
|
|
17
|
+
scrollForPan: Z,
|
|
18
18
|
spacingHorizontal: 80,
|
|
19
19
|
spacingVertical: 5,
|
|
20
20
|
initialExpandLevel: -1,
|
|
@@ -22,17 +22,17 @@ const V = typeof navigator < "u" && navigator.userAgent.includes("Macintosh"), x
|
|
|
22
22
|
pan: !0,
|
|
23
23
|
toggleRecursively: !1
|
|
24
24
|
};
|
|
25
|
-
function
|
|
26
|
-
const t = {},
|
|
27
|
-
if ((
|
|
28
|
-
const s =
|
|
25
|
+
function ye(e) {
|
|
26
|
+
const t = {}, i = { ...e }, { color: n, colorFreezeLevel: o } = i;
|
|
27
|
+
if ((n == null ? void 0 : n.length) === 1) {
|
|
28
|
+
const s = n[0];
|
|
29
29
|
t.color = () => s;
|
|
30
|
-
} else if (
|
|
31
|
-
const s =
|
|
30
|
+
} else if (n != null && n.length) {
|
|
31
|
+
const s = Y(n);
|
|
32
32
|
t.color = (c) => s(`${c.state.path}`);
|
|
33
33
|
}
|
|
34
34
|
if (o) {
|
|
35
|
-
const s = t.color ||
|
|
35
|
+
const s = t.color || q.color;
|
|
36
36
|
t.color = (c) => (c = {
|
|
37
37
|
...c,
|
|
38
38
|
state: {
|
|
@@ -52,184 +52,184 @@ function ue(e) {
|
|
|
52
52
|
"spacingHorizontal",
|
|
53
53
|
"spacingVertical"
|
|
54
54
|
].forEach((s) => {
|
|
55
|
-
const c =
|
|
55
|
+
const c = i[s];
|
|
56
56
|
typeof c == "number" && (t[s] = c);
|
|
57
57
|
}), ["zoom", "pan"].forEach((s) => {
|
|
58
|
-
const c =
|
|
58
|
+
const c = i[s];
|
|
59
59
|
c != null && (t[s] = !!c);
|
|
60
60
|
}), t;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function bt(e) {
|
|
63
63
|
let t = 0;
|
|
64
|
-
for (let
|
|
65
|
-
t = (t << 5) - t + e.charCodeAt(
|
|
64
|
+
for (let i = 0; i < e.length; i++)
|
|
65
|
+
t = (t << 5) - t + e.charCodeAt(i) | 0;
|
|
66
66
|
return (t >>> 0).toString(36);
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function k(e) {
|
|
69
69
|
if (typeof e == "string") {
|
|
70
|
-
const
|
|
71
|
-
e = (
|
|
70
|
+
const i = e;
|
|
71
|
+
e = (n) => n.matches(i);
|
|
72
72
|
}
|
|
73
73
|
const t = e;
|
|
74
74
|
return function() {
|
|
75
|
-
let
|
|
76
|
-
return t && (
|
|
75
|
+
let n = Array.from(this.childNodes);
|
|
76
|
+
return t && (n = n.filter((o) => t(o))), n;
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
var t = 0,
|
|
81
|
-
if (!
|
|
82
|
-
else for (; --
|
|
79
|
+
function Et(e) {
|
|
80
|
+
var t = 0, i = e.children, n = i && i.length;
|
|
81
|
+
if (!n) t = 1;
|
|
82
|
+
else for (; --n >= 0; ) t += i[n].value;
|
|
83
83
|
e.value = t;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
return this.eachAfter(
|
|
85
|
+
function zt() {
|
|
86
|
+
return this.eachAfter(Et);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
var t = this,
|
|
88
|
+
function wt(e) {
|
|
89
|
+
var t = this, i, n = [t], o, a, l;
|
|
90
90
|
do
|
|
91
|
-
for (
|
|
91
|
+
for (i = n.reverse(), n = []; t = i.pop(); )
|
|
92
92
|
if (e(t), o = t.children, o) for (a = 0, l = o.length; a < l; ++a)
|
|
93
|
-
|
|
94
|
-
while (
|
|
93
|
+
n.push(o[a]);
|
|
94
|
+
while (n.length);
|
|
95
95
|
return this;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
for (var t = this,
|
|
99
|
-
if (e(t),
|
|
100
|
-
|
|
97
|
+
function Ct(e) {
|
|
98
|
+
for (var t = this, i = [t], n, o; t = i.pop(); )
|
|
99
|
+
if (e(t), n = t.children, n) for (o = n.length - 1; o >= 0; --o)
|
|
100
|
+
i.push(n[o]);
|
|
101
101
|
return this;
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
for (var t = this,
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
for (; t =
|
|
103
|
+
function St(e) {
|
|
104
|
+
for (var t = this, i = [t], n = [], o, a, l; t = i.pop(); )
|
|
105
|
+
if (n.push(t), o = t.children, o) for (a = 0, l = o.length; a < l; ++a)
|
|
106
|
+
i.push(o[a]);
|
|
107
|
+
for (; t = n.pop(); )
|
|
108
108
|
e(t);
|
|
109
109
|
return this;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function Rt(e) {
|
|
112
112
|
return this.eachAfter(function(t) {
|
|
113
|
-
for (var
|
|
114
|
-
t.value =
|
|
113
|
+
for (var i = +e(t.data) || 0, n = t.children, o = n && n.length; --o >= 0; ) i += n[o].value;
|
|
114
|
+
t.value = i;
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function Xt(e) {
|
|
118
118
|
return this.eachBefore(function(t) {
|
|
119
119
|
t.children && t.children.sort(e);
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
for (var t = this,
|
|
124
|
-
t = t.parent,
|
|
125
|
-
for (var o =
|
|
126
|
-
|
|
127
|
-
return
|
|
122
|
+
function jt(e) {
|
|
123
|
+
for (var t = this, i = _t(t, e), n = [t]; t !== i; )
|
|
124
|
+
t = t.parent, n.push(t);
|
|
125
|
+
for (var o = n.length; e !== i; )
|
|
126
|
+
n.splice(o, 0, e), e = e.parent;
|
|
127
|
+
return n;
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function _t(e, t) {
|
|
130
130
|
if (e === t) return e;
|
|
131
|
-
var
|
|
132
|
-
for (e =
|
|
133
|
-
o = e, e =
|
|
131
|
+
var i = e.ancestors(), n = t.ancestors(), o = null;
|
|
132
|
+
for (e = i.pop(), t = n.pop(); e === t; )
|
|
133
|
+
o = e, e = i.pop(), t = n.pop();
|
|
134
134
|
return o;
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function Mt() {
|
|
137
137
|
for (var e = this, t = [e]; e = e.parent; )
|
|
138
138
|
t.push(e);
|
|
139
139
|
return t;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function Ot() {
|
|
142
142
|
var e = [];
|
|
143
143
|
return this.each(function(t) {
|
|
144
144
|
e.push(t);
|
|
145
145
|
}), e;
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function At() {
|
|
148
148
|
var e = [];
|
|
149
149
|
return this.eachBefore(function(t) {
|
|
150
150
|
t.children || e.push(t);
|
|
151
151
|
}), e;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function Tt() {
|
|
154
154
|
var e = this, t = [];
|
|
155
|
-
return e.each(function(
|
|
156
|
-
|
|
155
|
+
return e.each(function(i) {
|
|
156
|
+
i !== e && t.push({ source: i.parent, target: i });
|
|
157
157
|
}), t;
|
|
158
158
|
}
|
|
159
|
-
function
|
|
160
|
-
var
|
|
159
|
+
function H(e, t) {
|
|
160
|
+
var i = new j(e), n = +e.value && (i.value = e.value), o, a = [i], l, s, c, p;
|
|
161
161
|
for (t == null && (t = Bt); o = a.pop(); )
|
|
162
|
-
if (
|
|
162
|
+
if (n && (o.value = +o.data.value), (s = t(o.data)) && (p = s.length))
|
|
163
163
|
for (o.children = new Array(p), c = p - 1; c >= 0; --c)
|
|
164
|
-
a.push(l = o.children[c] = new
|
|
165
|
-
return
|
|
164
|
+
a.push(l = o.children[c] = new j(s[c])), l.parent = o, l.depth = o.depth + 1;
|
|
165
|
+
return i.eachBefore(Dt);
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
return
|
|
167
|
+
function Ht() {
|
|
168
|
+
return H(this).eachBefore(Lt);
|
|
169
169
|
}
|
|
170
170
|
function Bt(e) {
|
|
171
171
|
return e.children;
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function Lt(e) {
|
|
174
174
|
e.data = e.data.data;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function Dt(e) {
|
|
177
177
|
var t = 0;
|
|
178
178
|
do
|
|
179
179
|
e.height = t;
|
|
180
180
|
while ((e = e.parent) && e.height < ++t);
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function j(e) {
|
|
183
183
|
this.data = e, this.depth = this.height = 0, this.parent = null;
|
|
184
184
|
}
|
|
185
|
-
|
|
186
|
-
constructor:
|
|
187
|
-
count:
|
|
188
|
-
each:
|
|
189
|
-
eachAfter:
|
|
190
|
-
eachBefore:
|
|
191
|
-
sum:
|
|
192
|
-
sort:
|
|
193
|
-
path:
|
|
194
|
-
ancestors:
|
|
195
|
-
descendants:
|
|
196
|
-
leaves:
|
|
197
|
-
links:
|
|
198
|
-
copy:
|
|
185
|
+
j.prototype = H.prototype = {
|
|
186
|
+
constructor: j,
|
|
187
|
+
count: zt,
|
|
188
|
+
each: wt,
|
|
189
|
+
eachAfter: St,
|
|
190
|
+
eachBefore: Ct,
|
|
191
|
+
sum: Rt,
|
|
192
|
+
sort: Xt,
|
|
193
|
+
path: jt,
|
|
194
|
+
ancestors: Mt,
|
|
195
|
+
descendants: Ot,
|
|
196
|
+
leaves: At,
|
|
197
|
+
links: Tt,
|
|
198
|
+
copy: Ht
|
|
199
199
|
};
|
|
200
|
-
const
|
|
201
|
-
name:
|
|
202
|
-
version:
|
|
200
|
+
const Ft = "d3-flextree", $t = "2.1.2", Nt = "build/d3-flextree.js", It = "index", Pt = { name: "Chris Maloney", url: "http://chrismaloney.org" }, Wt = "Flexible tree layout algorithm that allows for variable node sizes.", Kt = ["d3", "d3-module", "layout", "tree", "hierarchy", "d3-hierarchy", "plugin", "d3-plugin", "infovis", "visualization", "2d"], Gt = "https://github.com/klortho/d3-flextree", Vt = "WTFPL", Ut = { type: "git", url: "https://github.com/klortho/d3-flextree.git" }, Yt = { clean: "rm -rf build demo test", "build:demo": "rollup -c --environment BUILD:demo", "build:dev": "rollup -c --environment BUILD:dev", "build:prod": "rollup -c --environment BUILD:prod", "build:test": "rollup -c --environment BUILD:test", build: "rollup -c", lint: "eslint index.js src", "test:main": "node test/bundle.js", "test:browser": "node test/browser-tests.js", test: "npm-run-all test:*", prepare: "npm-run-all clean build lint test" }, Zt = { "d3-hierarchy": "^1.1.5" }, qt = { "babel-plugin-external-helpers": "^6.22.0", "babel-preset-es2015-rollup": "^3.0.0", d3: "^4.13.0", "d3-selection-multi": "^1.0.1", eslint: "^4.19.1", jsdom: "^11.6.2", "npm-run-all": "^4.1.2", rollup: "^0.55.3", "rollup-plugin-babel": "^2.7.1", "rollup-plugin-commonjs": "^8.0.2", "rollup-plugin-copy": "^0.2.3", "rollup-plugin-json": "^2.3.0", "rollup-plugin-node-resolve": "^3.0.2", "rollup-plugin-uglify": "^3.0.0", "uglify-es": "^3.3.9" }, Jt = {
|
|
201
|
+
name: Ft,
|
|
202
|
+
version: $t,
|
|
203
203
|
main: Nt,
|
|
204
|
-
module:
|
|
204
|
+
module: It,
|
|
205
205
|
"jsnext:main": "index",
|
|
206
|
-
author:
|
|
207
|
-
description:
|
|
208
|
-
keywords:
|
|
209
|
-
homepage:
|
|
210
|
-
license:
|
|
211
|
-
repository:
|
|
212
|
-
scripts:
|
|
213
|
-
dependencies:
|
|
214
|
-
devDependencies:
|
|
215
|
-
}, { version:
|
|
206
|
+
author: Pt,
|
|
207
|
+
description: Wt,
|
|
208
|
+
keywords: Kt,
|
|
209
|
+
homepage: Gt,
|
|
210
|
+
license: Vt,
|
|
211
|
+
repository: Ut,
|
|
212
|
+
scripts: Yt,
|
|
213
|
+
dependencies: Zt,
|
|
214
|
+
devDependencies: qt
|
|
215
|
+
}, { version: Qt } = Jt, te = Object.freeze({
|
|
216
216
|
children: (e) => e.children,
|
|
217
217
|
nodeSize: (e) => e.data.size,
|
|
218
218
|
spacing: 0
|
|
219
219
|
});
|
|
220
|
-
function
|
|
221
|
-
const t = Object.assign({},
|
|
222
|
-
function
|
|
220
|
+
function Q(e) {
|
|
221
|
+
const t = Object.assign({}, te, e);
|
|
222
|
+
function i(s) {
|
|
223
223
|
const c = t[s];
|
|
224
224
|
return typeof c == "function" ? c : () => c;
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function n(s) {
|
|
227
227
|
const c = l(a(), s, (p) => p.children);
|
|
228
228
|
return c.update(), c.data;
|
|
229
229
|
}
|
|
230
230
|
function o() {
|
|
231
|
-
const s =
|
|
232
|
-
return class
|
|
231
|
+
const s = i("nodeSize"), c = i("spacing");
|
|
232
|
+
return class J extends H.prototype.constructor {
|
|
233
233
|
constructor(h) {
|
|
234
234
|
super(h);
|
|
235
235
|
}
|
|
@@ -285,7 +285,7 @@ function Z(e) {
|
|
|
285
285
|
}
|
|
286
286
|
get extents() {
|
|
287
287
|
return (this.children || []).reduce(
|
|
288
|
-
(h, u) =>
|
|
288
|
+
(h, u) => J.maxExtents(h, u.extents),
|
|
289
289
|
this.nodeExtents
|
|
290
290
|
);
|
|
291
291
|
}
|
|
@@ -308,7 +308,7 @@ function Z(e) {
|
|
|
308
308
|
};
|
|
309
309
|
}
|
|
310
310
|
function a() {
|
|
311
|
-
const s = o(), c =
|
|
311
|
+
const s = o(), c = i("nodeSize"), p = i("spacing");
|
|
312
312
|
return class extends s {
|
|
313
313
|
constructor(h) {
|
|
314
314
|
super(h), Object.assign(this, {
|
|
@@ -345,180 +345,180 @@ function Z(e) {
|
|
|
345
345
|
this.data.y = h;
|
|
346
346
|
}
|
|
347
347
|
update() {
|
|
348
|
-
return
|
|
348
|
+
return tt(this), et(this), this;
|
|
349
349
|
}
|
|
350
350
|
};
|
|
351
351
|
}
|
|
352
352
|
function l(s, c, p) {
|
|
353
|
-
const h = (u,
|
|
354
|
-
const
|
|
355
|
-
Object.assign(
|
|
356
|
-
parent:
|
|
357
|
-
depth:
|
|
353
|
+
const h = (u, g) => {
|
|
354
|
+
const m = new s(u);
|
|
355
|
+
Object.assign(m, {
|
|
356
|
+
parent: g,
|
|
357
|
+
depth: g === null ? 0 : g.depth + 1,
|
|
358
358
|
height: 0,
|
|
359
359
|
length: 1
|
|
360
360
|
});
|
|
361
361
|
const y = p(u) || [];
|
|
362
|
-
return
|
|
363
|
-
(
|
|
364
|
-
height: Math.max(
|
|
365
|
-
length:
|
|
362
|
+
return m.children = y.length === 0 ? null : y.map((f) => h(f, m)), m.children && Object.assign(m, m.children.reduce(
|
|
363
|
+
(f, b) => ({
|
|
364
|
+
height: Math.max(f.height, b.height + 1),
|
|
365
|
+
length: f.length + b.length
|
|
366
366
|
}),
|
|
367
|
-
|
|
368
|
-
)),
|
|
367
|
+
m
|
|
368
|
+
)), m;
|
|
369
369
|
};
|
|
370
370
|
return h(c, null);
|
|
371
371
|
}
|
|
372
|
-
return Object.assign(
|
|
372
|
+
return Object.assign(n, {
|
|
373
373
|
nodeSize(s) {
|
|
374
|
-
return arguments.length ? (t.nodeSize = s,
|
|
374
|
+
return arguments.length ? (t.nodeSize = s, n) : t.nodeSize;
|
|
375
375
|
},
|
|
376
376
|
spacing(s) {
|
|
377
|
-
return arguments.length ? (t.spacing = s,
|
|
377
|
+
return arguments.length ? (t.spacing = s, n) : t.spacing;
|
|
378
378
|
},
|
|
379
379
|
children(s) {
|
|
380
|
-
return arguments.length ? (t.children = s,
|
|
380
|
+
return arguments.length ? (t.children = s, n) : t.children;
|
|
381
381
|
},
|
|
382
382
|
hierarchy(s, c) {
|
|
383
383
|
const p = typeof c > "u" ? t.children : c;
|
|
384
384
|
return l(o(), s, p);
|
|
385
385
|
},
|
|
386
386
|
dump(s) {
|
|
387
|
-
const c =
|
|
388
|
-
const
|
|
389
|
-
return `{ size: [${b.join(", ")}],${
|
|
387
|
+
const c = i("nodeSize"), p = (h) => (u) => {
|
|
388
|
+
const g = h + " ", m = h + " ", { x: y, y: f } = u, b = c(u), v = u.children || [], w = v.length === 0 ? " " : `,${g}children: [${m}${v.map(p(m)).join(m)}${g}],${h}`;
|
|
389
|
+
return `{ size: [${b.join(", ")}],${g}x: ${y}, y: ${f}${w}},`;
|
|
390
390
|
};
|
|
391
391
|
return p(`
|
|
392
392
|
`)(s);
|
|
393
393
|
}
|
|
394
|
-
}),
|
|
394
|
+
}), n;
|
|
395
395
|
}
|
|
396
|
-
|
|
397
|
-
const
|
|
398
|
-
const [o, a] =
|
|
399
|
-
|
|
400
|
-
const l = (o === 0 ?
|
|
401
|
-
o !== 0 &&
|
|
402
|
-
const s =
|
|
396
|
+
Q.version = Qt;
|
|
397
|
+
const tt = (e, t = 0) => (e.y = t, (e.children || []).reduce((i, n) => {
|
|
398
|
+
const [o, a] = i;
|
|
399
|
+
tt(n, e.y + e.ySize);
|
|
400
|
+
const l = (o === 0 ? n.lExt : n.rExt).bottom;
|
|
401
|
+
o !== 0 && re(e, o, a);
|
|
402
|
+
const s = he(l, o, a);
|
|
403
403
|
return [o + 1, s];
|
|
404
|
-
}, [0, null]),
|
|
405
|
-
typeof t > "u" && (t = -e.relX - e.prelim,
|
|
406
|
-
const
|
|
407
|
-
return e.relX =
|
|
408
|
-
},
|
|
409
|
-
(e.children || []).reduce((t,
|
|
410
|
-
const [
|
|
411
|
-
return
|
|
404
|
+
}, [0, null]), ee(e), ce(e), e), et = (e, t, i) => {
|
|
405
|
+
typeof t > "u" && (t = -e.relX - e.prelim, i = 0);
|
|
406
|
+
const n = t + e.relX;
|
|
407
|
+
return e.relX = n + e.prelim - i, e.prelim = 0, e.x = i + e.relX, (e.children || []).forEach((o) => et(o, n, e.x)), e;
|
|
408
|
+
}, ee = (e) => {
|
|
409
|
+
(e.children || []).reduce((t, i) => {
|
|
410
|
+
const [n, o] = t, a = n + i.shift, l = o + a + i.change;
|
|
411
|
+
return i.relX += l, [a, l];
|
|
412
412
|
}, [0, 0]);
|
|
413
|
-
},
|
|
414
|
-
const
|
|
415
|
-
let a =
|
|
413
|
+
}, re = (e, t, i) => {
|
|
414
|
+
const n = e.children[t - 1], o = e.children[t];
|
|
415
|
+
let a = n, l = n.relX, s = o, c = o.relX, p = !0;
|
|
416
416
|
for (; a && s; ) {
|
|
417
|
-
a.bottom >
|
|
417
|
+
a.bottom > i.lowY && (i = i.next);
|
|
418
418
|
const h = l + a.prelim - (c + s.prelim) + a.xSize / 2 + s.xSize / 2 + a.spacing(s);
|
|
419
|
-
(h > 0 || h < 0 && p) && (c += h,
|
|
420
|
-
const u = a.bottom,
|
|
421
|
-
u <=
|
|
419
|
+
(h > 0 || h < 0 && p) && (c += h, ne(o, h), ie(e, t, i.index, h)), p = !1;
|
|
420
|
+
const u = a.bottom, g = s.bottom;
|
|
421
|
+
u <= g && (a = oe(a), a && (l += a.relX)), u >= g && (s = se(s), s && (c += s.relX));
|
|
422
422
|
}
|
|
423
|
-
!a && s ?
|
|
424
|
-
},
|
|
423
|
+
!a && s ? ae(e, t, s, c) : a && !s && le(e, t, a, l);
|
|
424
|
+
}, ne = (e, t) => {
|
|
425
425
|
e.relX += t, e.lExtRelX += t, e.rExtRelX += t;
|
|
426
|
-
},
|
|
427
|
-
const o = e.children[t], a = t -
|
|
426
|
+
}, ie = (e, t, i, n) => {
|
|
427
|
+
const o = e.children[t], a = t - i;
|
|
428
428
|
if (a > 1) {
|
|
429
|
-
const l =
|
|
430
|
-
e.children[
|
|
429
|
+
const l = n / a;
|
|
430
|
+
e.children[i + 1].shift += l, o.shift -= l, o.change -= n - l;
|
|
431
431
|
}
|
|
432
|
-
},
|
|
432
|
+
}, se = (e) => e.hasChildren ? e.firstChild : e.lThr, oe = (e) => e.hasChildren ? e.lastChild : e.rThr, ae = (e, t, i, n) => {
|
|
433
433
|
const o = e.firstChild, a = o.lExt, l = e.children[t];
|
|
434
|
-
a.lThr =
|
|
435
|
-
const s =
|
|
434
|
+
a.lThr = i;
|
|
435
|
+
const s = n - i.relX - o.lExtRelX;
|
|
436
436
|
a.relX += s, a.prelim -= s, o.lExt = l.lExt, o.lExtRelX = l.lExtRelX;
|
|
437
|
-
},
|
|
437
|
+
}, le = (e, t, i, n) => {
|
|
438
438
|
const o = e.children[t], a = o.rExt, l = e.children[t - 1];
|
|
439
|
-
a.rThr =
|
|
440
|
-
const s =
|
|
439
|
+
a.rThr = i;
|
|
440
|
+
const s = n - i.relX - o.rExtRelX;
|
|
441
441
|
a.relX += s, a.prelim -= s, o.rExt = l.rExt, o.rExtRelX = l.rExtRelX;
|
|
442
|
-
},
|
|
442
|
+
}, ce = (e) => {
|
|
443
443
|
if (e.hasChildren) {
|
|
444
|
-
const t = e.firstChild,
|
|
444
|
+
const t = e.firstChild, i = e.lastChild, n = (t.prelim + t.relX - t.xSize / 2 + i.relX + i.prelim + i.xSize / 2) / 2;
|
|
445
445
|
Object.assign(e, {
|
|
446
|
-
prelim:
|
|
446
|
+
prelim: n,
|
|
447
447
|
lExt: t.lExt,
|
|
448
448
|
lExtRelX: t.lExtRelX,
|
|
449
|
-
rExt:
|
|
450
|
-
rExtRelX:
|
|
449
|
+
rExt: i.rExt,
|
|
450
|
+
rExtRelX: i.rExtRelX
|
|
451
451
|
});
|
|
452
452
|
}
|
|
453
|
-
},
|
|
454
|
-
for (;
|
|
455
|
-
|
|
453
|
+
}, he = (e, t, i) => {
|
|
454
|
+
for (; i !== null && e >= i.lowY; )
|
|
455
|
+
i = i.next;
|
|
456
456
|
return {
|
|
457
457
|
lowY: e,
|
|
458
458
|
index: t,
|
|
459
|
-
next:
|
|
459
|
+
next: i
|
|
460
460
|
};
|
|
461
|
-
},
|
|
462
|
-
function
|
|
461
|
+
}, rt = ".markmap{--markmap-max-width: 9999px;--markmap-a-color: #0097e6;--markmap-a-hover-color: #00a8ff;--markmap-code-bg: #f0f0f0;--markmap-code-color: #555;--markmap-highlight-bg: #ffeaa7;--markmap-table-border: 1px solid currentColor;--markmap-font: 300 16px/20px sans-serif;--markmap-circle-open-bg: #fff;--markmap-text-color: #333;--markmap-highlight-node-bg: #ff02;font:var(--markmap-font);color:var(--markmap-text-color)}.markmap-link{fill:none}.markmap-node>circle{cursor:pointer}.markmap-foreign{display:inline-block}.markmap-foreign p{margin:0}.markmap-foreign a{color:var(--markmap-a-color)}.markmap-foreign a:hover{color:var(--markmap-a-hover-color)}.markmap-foreign code{padding:.25em;font-size:calc(1em - 2px);color:var(--markmap-code-color);background-color:var(--markmap-code-bg);border-radius:2px}.markmap-foreign pre{margin:0}.markmap-foreign pre>code{display:block}.markmap-foreign del{text-decoration:line-through}.markmap-foreign em{font-style:italic}.markmap-foreign strong{font-weight:700}.markmap-foreign mark{background:var(--markmap-highlight-bg)}.markmap-foreign table,.markmap-foreign th,.markmap-foreign td{border-collapse:collapse;border:var(--markmap-table-border)}.markmap-foreign img{display:inline-block}.markmap-foreign svg{fill:currentColor}.markmap-foreign>div{width:var(--markmap-max-width);text-align:left}.markmap-foreign>div>div{display:inline-block}.markmap-highlight rect{fill:var(--markmap-highlight-node-bg)}.markmap-dark .markmap{--markmap-code-bg: #1a1b26;--markmap-code-color: #ddd;--markmap-circle-open-bg: #444;--markmap-text-color: #eee}", ke = rt, O = "g.markmap-node", de = "path.markmap-link", pe = "g.markmap-highlight", A = mt();
|
|
462
|
+
function V(e) {
|
|
463
463
|
return Math.max(4 - 2 * e.state.depth, 1.5);
|
|
464
464
|
}
|
|
465
|
-
function
|
|
466
|
-
const
|
|
467
|
-
return e[
|
|
465
|
+
function U(e, t) {
|
|
466
|
+
const i = kt(e, t);
|
|
467
|
+
return e[i];
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function T(e) {
|
|
470
470
|
e.stopPropagation();
|
|
471
471
|
}
|
|
472
|
-
const
|
|
473
|
-
class
|
|
474
|
-
constructor(t,
|
|
475
|
-
this.options =
|
|
476
|
-
const { transform: o } =
|
|
472
|
+
const ue = new ht();
|
|
473
|
+
class nt {
|
|
474
|
+
constructor(t, i) {
|
|
475
|
+
this.options = q, this._disposeList = [], this.handleZoom = (n) => {
|
|
476
|
+
const { transform: o } = n;
|
|
477
477
|
this.g.attr("transform", o);
|
|
478
|
-
}, this.handlePan = (
|
|
479
|
-
|
|
480
|
-
const o =
|
|
481
|
-
-
|
|
482
|
-
-
|
|
478
|
+
}, this.handlePan = (n) => {
|
|
479
|
+
n.preventDefault();
|
|
480
|
+
const o = z(this.svg.node()), a = o.translate(
|
|
481
|
+
-n.deltaX / o.k,
|
|
482
|
+
-n.deltaY / o.k
|
|
483
483
|
);
|
|
484
484
|
this.svg.call(this.zoom.transform, a);
|
|
485
|
-
}, this.handleClick = (
|
|
485
|
+
}, this.handleClick = (n, o) => {
|
|
486
486
|
let a = this.options.toggleRecursively;
|
|
487
|
-
(
|
|
488
|
-
}, this.ensureView = this.ensureVisible, this.svg = t.datum ? t :
|
|
489
|
-
id: this.options.id || this.svg.attr("id") ||
|
|
487
|
+
(Z ? n.metaKey : n.ctrlKey) && (a = !a), this.toggleNode(o, a);
|
|
488
|
+
}, this.ensureView = this.ensureVisible, this.svg = t.datum ? t : ft(t), this.styleNode = this.svg.append("style"), this.zoom = xt().filter((n) => this.options.scrollForPan && n.type === "wheel" ? n.ctrlKey && !n.button : (!n.ctrlKey || n.type === "wheel") && !n.button).on("zoom", this.handleZoom), this.setOptions(i), this.state = {
|
|
489
|
+
id: this.options.id || this.svg.attr("id") || dt(),
|
|
490
490
|
rect: { x1: 0, y1: 0, x2: 0, y2: 0 }
|
|
491
|
-
}, this.g = this.svg.append("g"), this.
|
|
492
|
-
|
|
491
|
+
}, this.g = this.svg.append("g"), this.g.append("g").attr("class", "markmap-highlight"), this._observer = new ResizeObserver(
|
|
492
|
+
pt(() => {
|
|
493
493
|
this.renderData();
|
|
494
494
|
}, 100)
|
|
495
|
-
), this.
|
|
496
|
-
|
|
495
|
+
), this._disposeList.push(
|
|
496
|
+
ue.tap(() => {
|
|
497
497
|
this.setData();
|
|
498
498
|
}),
|
|
499
|
-
() => this.
|
|
499
|
+
() => this._observer.disconnect()
|
|
500
500
|
);
|
|
501
501
|
}
|
|
502
502
|
getStyleContent() {
|
|
503
|
-
const { style: t } = this.options, { id:
|
|
504
|
-
return [this.options.embedGlobalCSS &&
|
|
503
|
+
const { style: t } = this.options, { id: i } = this.state, n = typeof t == "function" ? t(i) : "";
|
|
504
|
+
return [this.options.embedGlobalCSS && rt, n].filter(Boolean).join(`
|
|
505
505
|
`);
|
|
506
506
|
}
|
|
507
507
|
updateStyle() {
|
|
508
508
|
this.svg.attr(
|
|
509
509
|
"class",
|
|
510
|
-
|
|
510
|
+
ut(this.svg.attr("class"), "markmap", this.state.id)
|
|
511
511
|
);
|
|
512
512
|
const t = this.getStyleContent();
|
|
513
513
|
this.styleNode.text(t);
|
|
514
514
|
}
|
|
515
|
-
async toggleNode(t,
|
|
515
|
+
async toggleNode(t, i = !1) {
|
|
516
516
|
var o, a;
|
|
517
|
-
const
|
|
518
|
-
|
|
517
|
+
const n = (o = t.payload) != null && o.fold ? 0 : 1;
|
|
518
|
+
i ? R(t, (l, s) => {
|
|
519
519
|
l.payload = {
|
|
520
520
|
...l.payload,
|
|
521
|
-
fold:
|
|
521
|
+
fold: n
|
|
522
522
|
}, s();
|
|
523
523
|
}) : t.payload = {
|
|
524
524
|
...t.payload,
|
|
@@ -526,15 +526,15 @@ class tt {
|
|
|
526
526
|
}, await this.renderData(t);
|
|
527
527
|
}
|
|
528
528
|
_initializeData(t) {
|
|
529
|
-
let
|
|
530
|
-
const { color:
|
|
529
|
+
let i = 0;
|
|
530
|
+
const { color: n, initialExpandLevel: o } = this.options;
|
|
531
531
|
let a = 0, l = 0;
|
|
532
|
-
|
|
533
|
-
var u,
|
|
534
|
-
l += 1, s.children = (u = s.children) == null ? void 0 : u.map((
|
|
532
|
+
return R(t, (s, c, p) => {
|
|
533
|
+
var u, g, m, y;
|
|
534
|
+
l += 1, s.children = (u = s.children) == null ? void 0 : u.map((f) => ({ ...f })), i += 1, s.state = {
|
|
535
535
|
...s.state,
|
|
536
536
|
depth: l,
|
|
537
|
-
id:
|
|
537
|
+
id: i,
|
|
538
538
|
rect: {
|
|
539
539
|
x: 0,
|
|
540
540
|
y: 0,
|
|
@@ -542,27 +542,27 @@ class tt {
|
|
|
542
542
|
height: 0
|
|
543
543
|
},
|
|
544
544
|
size: [0, 0]
|
|
545
|
-
}, s.state.key = [(
|
|
545
|
+
}, s.state.key = [(g = p == null ? void 0 : p.state) == null ? void 0 : g.id, s.state.id].filter(Boolean).join(".") + bt(s.content), s.state.path = [(m = p == null ? void 0 : p.state) == null ? void 0 : m.path, s.state.id].filter(Boolean).join("."), n(s);
|
|
546
546
|
const h = ((y = s.payload) == null ? void 0 : y.fold) === 2;
|
|
547
547
|
h ? a += 1 : (a || o >= 0 && s.state.depth >= o) && (s.payload = { ...s.payload, fold: 1 }), c(), h && (a -= 1), l -= 1;
|
|
548
|
-
});
|
|
548
|
+
}), t;
|
|
549
549
|
}
|
|
550
550
|
_relayout() {
|
|
551
551
|
if (!this.state.data) return;
|
|
552
|
-
this.g.selectAll(
|
|
553
|
-
|
|
552
|
+
this.g.selectAll(k(O)).selectAll(
|
|
553
|
+
k("foreignObject")
|
|
554
554
|
).each(function(s) {
|
|
555
555
|
var h;
|
|
556
556
|
const c = (h = this.firstChild) == null ? void 0 : h.firstChild, p = [c.scrollWidth, c.scrollHeight];
|
|
557
557
|
s.state.size = p;
|
|
558
558
|
});
|
|
559
|
-
const { spacingHorizontal: t, paddingX:
|
|
559
|
+
const { spacingHorizontal: t, paddingX: i, spacingVertical: n } = this.options, o = Q({}).children((s) => {
|
|
560
560
|
var c;
|
|
561
561
|
if (!((c = s.payload) != null && c.fold)) return s.children;
|
|
562
562
|
}).nodeSize((s) => {
|
|
563
563
|
const [c, p] = s.data.state.size;
|
|
564
|
-
return [p, c + (c ?
|
|
565
|
-
}).spacing((s, c) => s.parent === c.parent ?
|
|
564
|
+
return [p, c + (c ? i * 2 : 0) + t];
|
|
565
|
+
}).spacing((s, c) => s.parent === c.parent ? n : n * 2), a = o.hierarchy(this.state.data);
|
|
566
566
|
o(a);
|
|
567
567
|
const l = a.descendants();
|
|
568
568
|
l.forEach((s) => {
|
|
@@ -574,13 +574,13 @@ class tt {
|
|
|
574
574
|
height: s.xSize
|
|
575
575
|
};
|
|
576
576
|
}), this.state.rect = {
|
|
577
|
-
x1:
|
|
578
|
-
y1:
|
|
579
|
-
x2:
|
|
577
|
+
x1: K(l, (s) => s.data.state.rect.x) || 0,
|
|
578
|
+
y1: K(l, (s) => s.data.state.rect.y) || 0,
|
|
579
|
+
x2: G(
|
|
580
580
|
l,
|
|
581
581
|
(s) => s.data.state.rect.x + s.data.state.rect.width
|
|
582
582
|
) || 0,
|
|
583
|
-
y2:
|
|
583
|
+
y2: G(
|
|
584
584
|
l,
|
|
585
585
|
(s) => s.data.state.rect.y + s.data.state.rect.height
|
|
586
586
|
) || 0
|
|
@@ -592,216 +592,227 @@ class tt {
|
|
|
592
592
|
...t
|
|
593
593
|
}, this.options.zoom ? this.svg.call(this.zoom) : this.svg.on(".zoom", null), this.options.pan ? this.svg.on("wheel", this.handlePan) : this.svg.on("wheel", null);
|
|
594
594
|
}
|
|
595
|
-
async setData(t,
|
|
596
|
-
|
|
595
|
+
async setData(t, i) {
|
|
596
|
+
i && this.setOptions(i), t && (this.state.data = this._initializeData(t)), this.state.data && (this.updateStyle(), await this.renderData());
|
|
597
|
+
}
|
|
598
|
+
async setHighlight(t) {
|
|
599
|
+
this.state.highlight = t || void 0, await this.renderData();
|
|
600
|
+
}
|
|
601
|
+
_getHighlightRect(t) {
|
|
602
|
+
const i = this.svg.node(), o = 4 / z(i).k, a = {
|
|
603
|
+
...t.state.rect
|
|
604
|
+
};
|
|
605
|
+
return a.x -= o, a.y -= o, a.width += 2 * o, a.height += 2 * o, a;
|
|
597
606
|
}
|
|
598
607
|
async renderData(t) {
|
|
599
|
-
const { paddingX:
|
|
608
|
+
const { paddingX: i, autoFit: n, color: o, maxWidth: a } = this.options, l = this.state.data;
|
|
600
609
|
if (!l) return;
|
|
601
610
|
const s = {}, c = {}, p = [];
|
|
602
|
-
|
|
611
|
+
R(l, (r, d, x) => {
|
|
603
612
|
var E;
|
|
604
|
-
(E =
|
|
613
|
+
(E = r.payload) != null && E.fold || d(), s[r.state.id] = r, x && (c[r.state.id] = x.state.id), p.push(r);
|
|
605
614
|
});
|
|
606
|
-
const h = {}, u = {},
|
|
607
|
-
!
|
|
608
|
-
h[d.state.id] =
|
|
615
|
+
const h = {}, u = {}, g = (r) => {
|
|
616
|
+
!r || h[r.state.id] || R(r, (d, x) => {
|
|
617
|
+
h[d.state.id] = r.state.id, x();
|
|
609
618
|
});
|
|
610
|
-
},
|
|
611
|
-
u[l.state.id] = l.state.rect, t &&
|
|
612
|
-
const
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
}),
|
|
617
|
-
|
|
618
|
-
}),
|
|
619
|
+
}, m = (r) => u[h[r.state.id]] || l.state.rect, y = (r) => (s[h[r.state.id]] || l).state.rect;
|
|
620
|
+
u[l.state.id] = l.state.rect, t && g(t);
|
|
621
|
+
const { highlight: f } = this.state;
|
|
622
|
+
let b = this.g.selectAll(k(pe)).selectAll(k("rect")).data(f ? [this._getHighlightRect(f)] : []).join("rect").attr("x", (r) => r.x).attr("y", (r) => r.y).attr("width", (r) => r.width).attr("height", (r) => r.height);
|
|
623
|
+
const v = this.g.selectAll(k(O)).each((r) => {
|
|
624
|
+
u[r.state.id] = r.state.rect;
|
|
625
|
+
}).data(p, (r) => r.state.key), w = v.enter().append("g").attr("data-depth", (r) => r.state.depth).attr("data-path", (r) => r.state.path).each((r) => {
|
|
626
|
+
g(s[c[r.state.id]]);
|
|
627
|
+
}), C = v.exit().each((r) => {
|
|
628
|
+
g(s[c[r.state.id]]);
|
|
629
|
+
}), S = v.merge(w).attr(
|
|
619
630
|
"class",
|
|
620
|
-
(
|
|
631
|
+
(r) => {
|
|
621
632
|
var d;
|
|
622
|
-
return ["markmap-node", ((d =
|
|
633
|
+
return ["markmap-node", ((d = r.payload) == null ? void 0 : d.fold) && "markmap-fold"].filter(Boolean).join(" ");
|
|
623
634
|
}
|
|
624
|
-
), B =
|
|
625
|
-
(
|
|
626
|
-
(
|
|
627
|
-
),
|
|
628
|
-
(
|
|
635
|
+
), B = S.selectAll(k("line")).data(
|
|
636
|
+
(r) => [r],
|
|
637
|
+
(r) => r.state.key
|
|
638
|
+
), L = B.enter().append("line").attr("stroke", (r) => o(r)).attr("stroke-width", 0), D = B.merge(L), F = S.selectAll(k("circle")).data(
|
|
639
|
+
(r) => {
|
|
629
640
|
var d;
|
|
630
|
-
return (d =
|
|
641
|
+
return (d = r.children) != null && d.length ? [r] : [];
|
|
631
642
|
},
|
|
632
|
-
(
|
|
633
|
-
),
|
|
643
|
+
(r) => r.state.key
|
|
644
|
+
), $ = F.enter().append("circle").attr("stroke-width", 0).attr("r", 0).on("click", (r, d) => this.handleClick(r, d)).on("mousedown", T).merge(F).attr("stroke", (r) => o(r)).attr(
|
|
634
645
|
"fill",
|
|
635
|
-
(
|
|
646
|
+
(r) => {
|
|
636
647
|
var d;
|
|
637
|
-
return (d =
|
|
648
|
+
return (d = r.payload) != null && d.fold && r.children ? o(r) : "var(--markmap-circle-open-bg)";
|
|
638
649
|
}
|
|
639
|
-
), N = this.
|
|
640
|
-
(
|
|
641
|
-
(
|
|
642
|
-
),
|
|
643
|
-
|
|
650
|
+
), N = this._observer, I = S.selectAll(k("foreignObject")).data(
|
|
651
|
+
(r) => [r],
|
|
652
|
+
(r) => r.state.key
|
|
653
|
+
), _ = I.enter().append("foreignObject").attr("class", "markmap-foreign").attr("x", i).attr("y", 0).style("opacity", 0).on("mousedown", T).on("dblclick", T);
|
|
654
|
+
_.append("xhtml:div").append("xhtml:div").html((r) => r.content).attr("xmlns", "http://www.w3.org/1999/xhtml"), _.each(function() {
|
|
644
655
|
var d;
|
|
645
|
-
const
|
|
646
|
-
N.observe(
|
|
656
|
+
const r = (d = this.firstChild) == null ? void 0 : d.firstChild;
|
|
657
|
+
N.observe(r);
|
|
647
658
|
});
|
|
648
|
-
const
|
|
649
|
-
|
|
659
|
+
const P = C.selectAll(
|
|
660
|
+
k("foreignObject")
|
|
650
661
|
);
|
|
651
|
-
|
|
662
|
+
P.each(function() {
|
|
652
663
|
var d;
|
|
653
|
-
const
|
|
654
|
-
N.unobserve(
|
|
664
|
+
const r = (d = this.firstChild) == null ? void 0 : d.firstChild;
|
|
665
|
+
N.unobserve(r);
|
|
655
666
|
});
|
|
656
|
-
const
|
|
657
|
-
(
|
|
667
|
+
const W = _.merge(I), it = p.flatMap(
|
|
668
|
+
(r) => {
|
|
658
669
|
var d;
|
|
659
|
-
return (d =
|
|
670
|
+
return (d = r.payload) != null && d.fold ? [] : r.children.map((x) => ({ source: r, target: x }));
|
|
660
671
|
}
|
|
661
|
-
), M = this.g.selectAll(
|
|
662
|
-
const d =
|
|
672
|
+
), M = this.g.selectAll(k(de)).data(it, (r) => r.target.state.key), st = M.exit(), ot = M.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) => {
|
|
673
|
+
const d = m(r.target), x = [
|
|
663
674
|
d.x + d.width,
|
|
664
675
|
d.y + d.height
|
|
665
676
|
];
|
|
666
|
-
return
|
|
677
|
+
return A({ source: x, target: x });
|
|
667
678
|
}).attr("stroke-width", 0).merge(M);
|
|
668
679
|
this.svg.style(
|
|
669
680
|
"--markmap-max-width",
|
|
670
681
|
a ? `${a}px` : null
|
|
671
|
-
), await new Promise(requestAnimationFrame), this._relayout(), b.attr("transform", (
|
|
672
|
-
const d =
|
|
673
|
-
return `translate(${d.x + d.width -
|
|
674
|
-
}), this.transition(
|
|
675
|
-
const d = y(
|
|
676
|
-
return `translate(${
|
|
677
|
-
}).remove(), this.transition(
|
|
682
|
+
), await new Promise(requestAnimationFrame), this._relayout(), b = b.data(f ? [this._getHighlightRect(f)] : []).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), w.attr("transform", (r) => {
|
|
683
|
+
const d = m(r);
|
|
684
|
+
return `translate(${d.x + d.width - r.state.rect.width},${d.y + d.height - r.state.rect.height})`;
|
|
685
|
+
}), this.transition(C).attr("transform", (r) => {
|
|
686
|
+
const d = y(r), x = d.x + d.width - r.state.rect.width, E = d.y + d.height - r.state.rect.height;
|
|
687
|
+
return `translate(${x},${E})`;
|
|
688
|
+
}).remove(), this.transition(S).attr(
|
|
678
689
|
"transform",
|
|
679
|
-
(
|
|
690
|
+
(r) => `translate(${r.state.rect.x},${r.state.rect.y})`
|
|
680
691
|
);
|
|
681
|
-
const
|
|
682
|
-
|
|
692
|
+
const at = C.selectAll(
|
|
693
|
+
k("line")
|
|
683
694
|
);
|
|
684
|
-
this.transition(
|
|
685
|
-
const
|
|
686
|
-
|
|
695
|
+
this.transition(at).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).attr("y2", (r) => r.state.rect.height), this.transition(D).attr("x1", -1).attr("x2", (r) => r.state.rect.width + 2).attr("stroke", (r) => o(r)).attr("stroke-width", V);
|
|
696
|
+
const lt = C.selectAll(
|
|
697
|
+
k("circle")
|
|
687
698
|
);
|
|
688
|
-
this.transition(
|
|
689
|
-
const d = y(
|
|
699
|
+
this.transition(lt).attr("r", 0).attr("stroke-width", 0), $.attr("cx", (r) => r.state.rect.width).attr("cy", (r) => r.state.rect.height), this.transition($).attr("r", 6).attr("stroke-width", "1.5"), this.transition(P).style("opacity", 0), W.attr("width", (r) => Math.max(0, r.state.rect.width - i * 2)).attr("height", (r) => r.state.rect.height), this.transition(W).style("opacity", 1), this.transition(st).attr("d", (r) => {
|
|
700
|
+
const d = y(r.target), x = [
|
|
690
701
|
d.x + d.width,
|
|
691
702
|
d.y + d.height
|
|
692
703
|
];
|
|
693
|
-
return
|
|
694
|
-
}).attr("stroke-width", 0).remove(), this.transition(
|
|
695
|
-
const d =
|
|
704
|
+
return A({ source: x, target: x });
|
|
705
|
+
}).attr("stroke-width", 0).remove(), this.transition(ot).attr("stroke", (r) => o(r.target)).attr("stroke-width", (r) => V(r.target)).attr("d", (r) => {
|
|
706
|
+
const d = r.source, x = r.target, E = [
|
|
696
707
|
d.state.rect.x + d.state.rect.width,
|
|
697
708
|
d.state.rect.y + d.state.rect.height
|
|
698
|
-
],
|
|
699
|
-
|
|
700
|
-
|
|
709
|
+
], ct = [
|
|
710
|
+
x.state.rect.x,
|
|
711
|
+
x.state.rect.y + x.state.rect.height
|
|
701
712
|
];
|
|
702
|
-
return
|
|
703
|
-
}),
|
|
713
|
+
return A({ source: E, target: ct });
|
|
714
|
+
}), n && this.fit();
|
|
704
715
|
}
|
|
705
716
|
transition(t) {
|
|
706
|
-
const { duration:
|
|
707
|
-
return t.transition().duration(
|
|
717
|
+
const { duration: i } = this.options;
|
|
718
|
+
return t.transition().duration(i);
|
|
708
719
|
}
|
|
709
720
|
/**
|
|
710
721
|
* Fit the content to the viewport.
|
|
711
722
|
*/
|
|
712
723
|
async fit(t = this.options.maxInitialScale) {
|
|
713
|
-
const
|
|
714
|
-
|
|
724
|
+
const i = this.svg.node(), { width: n, height: o } = i.getBoundingClientRect(), { fitRatio: a } = this.options, { x1: l, y1: s, x2: c, y2: p } = this.state.rect, h = c - l, u = p - s, g = Math.min(
|
|
725
|
+
n / h * a,
|
|
715
726
|
o / u * a,
|
|
716
727
|
t
|
|
717
|
-
),
|
|
718
|
-
(
|
|
719
|
-
(o - u *
|
|
720
|
-
).scale(
|
|
721
|
-
return this.transition(this.svg).call(this.zoom.transform,
|
|
728
|
+
), m = yt.translate(
|
|
729
|
+
(n - h * g) / 2 - l * g,
|
|
730
|
+
(o - u * g) / 2 - s * g
|
|
731
|
+
).scale(g);
|
|
732
|
+
return this.transition(this.svg).call(this.zoom.transform, m).end().catch(X);
|
|
722
733
|
}
|
|
723
734
|
findElement(t) {
|
|
724
|
-
let
|
|
725
|
-
return this.g.selectAll(
|
|
726
|
-
o === t && (
|
|
735
|
+
let i;
|
|
736
|
+
return this.g.selectAll(k(O)).each(function(o) {
|
|
737
|
+
o === t && (i = {
|
|
727
738
|
data: o,
|
|
728
739
|
g: this
|
|
729
740
|
});
|
|
730
|
-
}),
|
|
741
|
+
}), i;
|
|
731
742
|
}
|
|
732
743
|
/**
|
|
733
744
|
* Pan the content to make the provided node visible in the viewport.
|
|
734
745
|
*/
|
|
735
|
-
async ensureVisible(t,
|
|
746
|
+
async ensureVisible(t, i) {
|
|
736
747
|
var b;
|
|
737
|
-
const
|
|
738
|
-
if (!
|
|
739
|
-
const o = this.svg.node(), a = o.getBoundingClientRect(), l =
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
].map((
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
].map((
|
|
748
|
+
const n = (b = this.findElement(t)) == null ? void 0 : b.data;
|
|
749
|
+
if (!n) return;
|
|
750
|
+
const o = this.svg.node(), a = o.getBoundingClientRect(), l = z(o), [s, c] = [
|
|
751
|
+
n.state.rect.x,
|
|
752
|
+
n.state.rect.x + n.state.rect.width + 2
|
|
753
|
+
].map((v) => v * l.k + l.x), [p, h] = [
|
|
754
|
+
n.state.rect.y,
|
|
755
|
+
n.state.rect.y + n.state.rect.height
|
|
756
|
+
].map((v) => v * l.k + l.y), u = {
|
|
746
757
|
left: 0,
|
|
747
758
|
right: 0,
|
|
748
759
|
top: 0,
|
|
749
760
|
bottom: 0,
|
|
750
|
-
...
|
|
751
|
-
},
|
|
752
|
-
if (y ||
|
|
753
|
-
const
|
|
754
|
-
return this.transition(this.svg).call(this.zoom.transform,
|
|
761
|
+
...i
|
|
762
|
+
}, g = [u.left - s, a.width - u.right - c], m = [u.top - p, a.height - u.bottom - h], y = g[0] * g[1] > 0 ? U(g, Math.abs) / l.k : 0, f = m[0] * m[1] > 0 ? U(m, Math.abs) / l.k : 0;
|
|
763
|
+
if (y || f) {
|
|
764
|
+
const v = l.translate(y, f);
|
|
765
|
+
return this.transition(this.svg).call(this.zoom.transform, v).end().catch(X);
|
|
755
766
|
}
|
|
756
767
|
}
|
|
757
|
-
async centerNode(t,
|
|
768
|
+
async centerNode(t, i) {
|
|
758
769
|
var y;
|
|
759
|
-
const
|
|
760
|
-
if (!
|
|
761
|
-
const o = this.svg.node(), a = o.getBoundingClientRect(), l =
|
|
770
|
+
const n = (y = this.findElement(t)) == null ? void 0 : y.data;
|
|
771
|
+
if (!n) return;
|
|
772
|
+
const o = this.svg.node(), a = o.getBoundingClientRect(), l = z(o), s = (n.state.rect.x + n.state.rect.width / 2) * l.k + l.x, c = (n.state.rect.y + n.state.rect.height / 2) * l.k + l.y, p = {
|
|
762
773
|
left: 0,
|
|
763
774
|
right: 0,
|
|
764
775
|
top: 0,
|
|
765
776
|
bottom: 0,
|
|
766
|
-
...
|
|
767
|
-
}, h = (p.left + a.width - p.right) / 2, u = (p.top + a.height - p.bottom) / 2,
|
|
768
|
-
if (
|
|
769
|
-
const
|
|
770
|
-
return this.transition(this.svg).call(this.zoom.transform,
|
|
777
|
+
...i
|
|
778
|
+
}, h = (p.left + a.width - p.right) / 2, u = (p.top + a.height - p.bottom) / 2, g = (h - s) / l.k, m = (u - c) / l.k;
|
|
779
|
+
if (g || m) {
|
|
780
|
+
const f = l.translate(g, m);
|
|
781
|
+
return this.transition(this.svg).call(this.zoom.transform, f).end().catch(X);
|
|
771
782
|
}
|
|
772
783
|
}
|
|
773
784
|
/**
|
|
774
785
|
* Scale content with it pinned at the center of the viewport.
|
|
775
786
|
*/
|
|
776
787
|
async rescale(t) {
|
|
777
|
-
const
|
|
788
|
+
const i = this.svg.node(), { width: n, height: o } = i.getBoundingClientRect(), a = n / 2, l = o / 2, s = z(i), c = s.translate(
|
|
778
789
|
(a - s.x) * (1 - t) / s.k,
|
|
779
790
|
(l - s.y) * (1 - t) / s.k
|
|
780
791
|
).scale(t);
|
|
781
|
-
return this.transition(this.svg).call(this.zoom.transform, c).end().catch(
|
|
792
|
+
return this.transition(this.svg).call(this.zoom.transform, c).end().catch(X);
|
|
782
793
|
}
|
|
783
794
|
destroy() {
|
|
784
|
-
this.svg.on(".zoom", null), this.svg.html(null), this.
|
|
795
|
+
this.svg.on(".zoom", null), this.svg.html(null), this._disposeList.forEach((t) => {
|
|
785
796
|
t();
|
|
786
797
|
});
|
|
787
798
|
}
|
|
788
|
-
static create(t,
|
|
789
|
-
const o = new
|
|
790
|
-
return
|
|
799
|
+
static create(t, i, n = null) {
|
|
800
|
+
const o = new nt(t, i);
|
|
801
|
+
return n && o.setData(n).then(() => {
|
|
791
802
|
o.fit();
|
|
792
803
|
}), o;
|
|
793
804
|
}
|
|
794
805
|
}
|
|
795
806
|
export {
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
+
nt as Markmap,
|
|
808
|
+
k as childSelector,
|
|
809
|
+
vt as defaultColorFn,
|
|
810
|
+
q as defaultOptions,
|
|
811
|
+
ye as deriveOptions,
|
|
812
|
+
ke as globalCSS,
|
|
813
|
+
Z as isMacintosh,
|
|
814
|
+
Ee as loadCSS,
|
|
815
|
+
ze as loadJS,
|
|
816
|
+
ue as refreshHook,
|
|
817
|
+
bt as simpleHash
|
|
807
818
|
};
|
package/dist/types.d.ts
CHANGED
package/dist/view.d.ts
CHANGED
|
@@ -12,9 +12,9 @@ export declare class Markmap {
|
|
|
12
12
|
svg: ID3SVGElement;
|
|
13
13
|
styleNode: d3.Selection<HTMLStyleElement, INode, HTMLElement, INode>;
|
|
14
14
|
g: d3.Selection<SVGGElement, INode, HTMLElement, INode>;
|
|
15
|
-
observer: ResizeObserver;
|
|
16
15
|
zoom: d3.ZoomBehavior<SVGElement, INode>;
|
|
17
|
-
|
|
16
|
+
private _observer;
|
|
17
|
+
private _disposeList;
|
|
18
18
|
constructor(svg: string | SVGElement | ID3SVGElement, opts?: Partial<IMarkmapOptions>);
|
|
19
19
|
getStyleContent(): string;
|
|
20
20
|
updateStyle(): void;
|
|
@@ -26,6 +26,8 @@ export declare class Markmap {
|
|
|
26
26
|
private _relayout;
|
|
27
27
|
setOptions(opts?: Partial<IMarkmapOptions>): void;
|
|
28
28
|
setData(data?: IPureNode | null, opts?: Partial<IMarkmapOptions>): Promise<void>;
|
|
29
|
+
setHighlight(node?: INode | null): Promise<void>;
|
|
30
|
+
private _getHighlightRect;
|
|
29
31
|
renderData(originData?: INode): Promise<void>;
|
|
30
32
|
transition<T extends d3.BaseType, U, P extends d3.BaseType, Q>(sel: d3.Selection<T, U, P, Q>): d3.Transition<T, U, P, Q>;
|
|
31
33
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markmap-view",
|
|
3
|
-
"version": "0.18.5
|
|
3
|
+
"version": "0.18.5",
|
|
4
4
|
"description": "View markmaps in browser",
|
|
5
5
|
"author": "Gerald <gera2ld@live.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/d3-flextree": "^2.1.1",
|
|
49
|
-
"markmap-common": "0.18.5
|
|
49
|
+
"markmap-common": "0.18.5"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"markmap-common": "*"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "600776ac5b28110ab6f298d252263c740738660e"
|
|
55
55
|
}
|