markmap-view 0.18.5-alpha.6 → 0.18.5-alpha.7

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.
@@ -403,8 +403,8 @@
403
403
  }
404
404
  function childSelector(filter) {
405
405
  if (typeof filter === "string") {
406
- const tagName = filter;
407
- filter = (el) => el.tagName === tagName;
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.revokers = [];
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.observer = new ResizeObserver(
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.revokers.push(
1005
+ this._disposeList.push(
1002
1006
  refreshHook.tap(() => {
1003
1007
  this.setData();
1004
1008
  }),
1005
- () => this.observer.disconnect()
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("g")).selectAll(
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 mmG = this.g.selectAll(childSelector("g")).each((d) => {
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.observer;
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("path")).data(links, (d) => d.target.state.key);
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("g")).each(function walk(d) {
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.revokers.forEach((fn) => {
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 at, getId as lt, debounce as ct, addClass as ht, walkTree as C, noop as w } from "markmap-common";
2
- import { loadCSS as xe, loadJS as ye } from "markmap-common";
3
- import { scaleOrdinal as G, schemeCategory10 as dt, linkHorizontal as pt, zoomTransform as S, select as ut, zoom as mt, min as P, max as W, zoomIdentity as gt, minIndex as ft } from "d3";
4
- const V = typeof navigator < "u" && navigator.userAgent.includes("Macintosh"), xt = G(dt), U = {
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 xt(`${((t = e.state) == null ? void 0 : t.path) || ""}`);
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: V,
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 ue(e) {
26
- const t = {}, n = { ...e }, { color: r, colorFreezeLevel: o } = n;
27
- if ((r == null ? void 0 : r.length) === 1) {
28
- const s = r[0];
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 (r != null && r.length) {
31
- const s = G(r);
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 || U.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 = n[s];
55
+ const c = i[s];
56
56
  typeof c == "number" && (t[s] = c);
57
57
  }), ["zoom", "pan"].forEach((s) => {
58
- const c = n[s];
58
+ const c = i[s];
59
59
  c != null && (t[s] = !!c);
60
60
  }), t;
61
61
  }
62
- function yt(e) {
62
+ function bt(e) {
63
63
  let t = 0;
64
- for (let n = 0; n < e.length; n++)
65
- t = (t << 5) - t + e.charCodeAt(n) | 0;
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 v(e) {
68
+ function k(e) {
69
69
  if (typeof e == "string") {
70
- const n = e;
71
- e = (r) => r.tagName === n;
70
+ const i = e;
71
+ e = (n) => n.matches(i);
72
72
  }
73
73
  const t = e;
74
74
  return function() {
75
- let r = Array.from(this.childNodes);
76
- return t && (r = r.filter((o) => t(o))), r;
75
+ let n = Array.from(this.childNodes);
76
+ return t && (n = n.filter((o) => t(o))), n;
77
77
  };
78
78
  }
79
- function kt(e) {
80
- var t = 0, n = e.children, r = n && n.length;
81
- if (!r) t = 1;
82
- else for (; --r >= 0; ) t += n[r].value;
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 vt() {
86
- return this.eachAfter(kt);
85
+ function zt() {
86
+ return this.eachAfter(Et);
87
87
  }
88
- function bt(e) {
89
- var t = this, n, r = [t], o, a, l;
88
+ function wt(e) {
89
+ var t = this, i, n = [t], o, a, l;
90
90
  do
91
- for (n = r.reverse(), r = []; t = n.pop(); )
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
- r.push(o[a]);
94
- while (r.length);
93
+ n.push(o[a]);
94
+ while (n.length);
95
95
  return this;
96
96
  }
97
- function zt(e) {
98
- for (var t = this, n = [t], r, o; t = n.pop(); )
99
- if (e(t), r = t.children, r) for (o = r.length - 1; o >= 0; --o)
100
- n.push(r[o]);
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 Et(e) {
104
- for (var t = this, n = [t], r = [], o, a, l; t = n.pop(); )
105
- if (r.push(t), o = t.children, o) for (a = 0, l = o.length; a < l; ++a)
106
- n.push(o[a]);
107
- for (; t = r.pop(); )
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 Ct(e) {
111
+ function Rt(e) {
112
112
  return this.eachAfter(function(t) {
113
- for (var n = +e(t.data) || 0, r = t.children, o = r && r.length; --o >= 0; ) n += r[o].value;
114
- t.value = n;
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 wt(e) {
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 St(e) {
123
- for (var t = this, n = Rt(t, e), r = [t]; t !== n; )
124
- t = t.parent, r.push(t);
125
- for (var o = r.length; e !== n; )
126
- r.splice(o, 0, e), e = e.parent;
127
- return r;
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 Rt(e, t) {
129
+ function _t(e, t) {
130
130
  if (e === t) return e;
131
- var n = e.ancestors(), r = t.ancestors(), o = null;
132
- for (e = n.pop(), t = r.pop(); e === t; )
133
- o = e, e = n.pop(), t = r.pop();
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 Xt() {
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 Mt() {
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 jt() {
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 Ot() {
153
+ function Tt() {
154
154
  var e = this, t = [];
155
- return e.each(function(n) {
156
- n !== e && t.push({ source: n.parent, target: n });
155
+ return e.each(function(i) {
156
+ i !== e && t.push({ source: i.parent, target: i });
157
157
  }), t;
158
158
  }
159
- function A(e, t) {
160
- var n = new R(e), r = +e.value && (n.value = e.value), o, a = [n], l, s, c, p;
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 (r && (o.value = +o.data.value), (s = t(o.data)) && (p = s.length))
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 R(s[c])), l.parent = o, l.depth = o.depth + 1;
165
- return n.eachBefore($t);
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 At() {
168
- return A(this).eachBefore(Ft);
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 Ft(e) {
173
+ function Lt(e) {
174
174
  e.data = e.data.data;
175
175
  }
176
- function $t(e) {
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 R(e) {
182
+ function j(e) {
183
183
  this.data = e, this.depth = this.height = 0, this.parent = null;
184
184
  }
185
- R.prototype = A.prototype = {
186
- constructor: R,
187
- count: vt,
188
- each: bt,
189
- eachAfter: Et,
190
- eachBefore: zt,
191
- sum: Ct,
192
- sort: wt,
193
- path: St,
194
- ancestors: Xt,
195
- descendants: Mt,
196
- leaves: jt,
197
- links: Ot,
198
- copy: At
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 Tt = "d3-flextree", Dt = "2.1.2", Nt = "build/d3-flextree.js", _t = "index", Ht = { name: "Chris Maloney", url: "http://chrismaloney.org" }, Lt = "Flexible tree layout algorithm that allows for variable node sizes.", Pt = ["d3", "d3-module", "layout", "tree", "hierarchy", "d3-hierarchy", "plugin", "d3-plugin", "infovis", "visualization", "2d"], Wt = "https://github.com/klortho/d3-flextree", It = "WTFPL", Kt = { type: "git", url: "https://github.com/klortho/d3-flextree.git" }, Gt = { 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" }, Vt = { "d3-hierarchy": "^1.1.5" }, Ut = { "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" }, Yt = {
201
- name: Tt,
202
- version: Dt,
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: _t,
204
+ module: It,
205
205
  "jsnext:main": "index",
206
- author: Ht,
207
- description: Lt,
208
- keywords: Pt,
209
- homepage: Wt,
210
- license: It,
211
- repository: Kt,
212
- scripts: Gt,
213
- dependencies: Vt,
214
- devDependencies: Ut
215
- }, { version: Zt } = Yt, qt = Object.freeze({
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 Z(e) {
221
- const t = Object.assign({}, qt, e);
222
- function n(s) {
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 r(s) {
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 = n("nodeSize"), c = n("spacing");
232
- return class Y extends A.prototype.constructor {
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) => Y.maxExtents(h, u.extents),
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 = n("nodeSize"), p = n("spacing");
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 q(this), J(this), this;
348
+ return tt(this), et(this), this;
349
349
  }
350
350
  };
351
351
  }
352
352
  function l(s, c, p) {
353
- const h = (u, m) => {
354
- const g = new s(u);
355
- Object.assign(g, {
356
- parent: m,
357
- depth: m === null ? 0 : m.depth + 1,
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 g.children = y.length === 0 ? null : y.map((x) => h(x, g)), g.children && Object.assign(g, g.children.reduce(
363
- (x, b) => ({
364
- height: Math.max(x.height, b.height + 1),
365
- length: x.length + b.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
- g
368
- )), g;
367
+ m
368
+ )), m;
369
369
  };
370
370
  return h(c, null);
371
371
  }
372
- return Object.assign(r, {
372
+ return Object.assign(n, {
373
373
  nodeSize(s) {
374
- return arguments.length ? (t.nodeSize = s, r) : t.nodeSize;
374
+ return arguments.length ? (t.nodeSize = s, n) : t.nodeSize;
375
375
  },
376
376
  spacing(s) {
377
- return arguments.length ? (t.spacing = s, r) : t.spacing;
377
+ return arguments.length ? (t.spacing = s, n) : t.spacing;
378
378
  },
379
379
  children(s) {
380
- return arguments.length ? (t.children = s, r) : t.children;
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 = n("nodeSize"), p = (h) => (u) => {
388
- const m = h + " ", g = h + " ", { x: y, y: x } = u, b = c(u), k = u.children || [], z = k.length === 0 ? " " : `,${m}children: [${g}${k.map(p(g)).join(g)}${m}],${h}`;
389
- return `{ size: [${b.join(", ")}],${m}x: ${y}, y: ${x}${z}},`;
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
- }), r;
394
+ }), n;
395
395
  }
396
- Z.version = Zt;
397
- const q = (e, t = 0) => (e.y = t, (e.children || []).reduce((n, r) => {
398
- const [o, a] = n;
399
- q(r, e.y + e.ySize);
400
- const l = (o === 0 ? r.lExt : r.rExt).bottom;
401
- o !== 0 && Qt(e, o, a);
402
- const s = ae(l, o, a);
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]), Jt(e), oe(e), e), J = (e, t, n) => {
405
- typeof t > "u" && (t = -e.relX - e.prelim, n = 0);
406
- const r = t + e.relX;
407
- return e.relX = r + e.prelim - n, e.prelim = 0, e.x = n + e.relX, (e.children || []).forEach((o) => J(o, r, e.x)), e;
408
- }, Jt = (e) => {
409
- (e.children || []).reduce((t, n) => {
410
- const [r, o] = t, a = r + n.shift, l = o + a + n.change;
411
- return n.relX += l, [a, l];
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
- }, Qt = (e, t, n) => {
414
- const r = e.children[t - 1], o = e.children[t];
415
- let a = r, l = r.relX, s = o, c = o.relX, p = !0;
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 > n.lowY && (n = n.next);
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, te(o, h), ee(e, t, n.index, h)), p = !1;
420
- const u = a.bottom, m = s.bottom;
421
- u <= m && (a = ne(a), a && (l += a.relX)), u >= m && (s = re(s), s && (c += s.relX));
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 ? se(e, t, s, c) : a && !s && ie(e, t, a, l);
424
- }, te = (e, t) => {
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
- }, ee = (e, t, n, r) => {
427
- const o = e.children[t], a = t - n;
426
+ }, ie = (e, t, i, n) => {
427
+ const o = e.children[t], a = t - i;
428
428
  if (a > 1) {
429
- const l = r / a;
430
- e.children[n + 1].shift += l, o.shift -= l, o.change -= r - l;
429
+ const l = n / a;
430
+ e.children[i + 1].shift += l, o.shift -= l, o.change -= n - l;
431
431
  }
432
- }, re = (e) => e.hasChildren ? e.firstChild : e.lThr, ne = (e) => e.hasChildren ? e.lastChild : e.rThr, se = (e, t, n, r) => {
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 = n;
435
- const s = r - n.relX - o.lExtRelX;
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
- }, ie = (e, t, n, r) => {
437
+ }, le = (e, t, i, n) => {
438
438
  const o = e.children[t], a = o.rExt, l = e.children[t - 1];
439
- a.rThr = n;
440
- const s = r - n.relX - o.rExtRelX;
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
- }, oe = (e) => {
442
+ }, ce = (e) => {
443
443
  if (e.hasChildren) {
444
- const t = e.firstChild, n = e.lastChild, r = (t.prelim + t.relX - t.xSize / 2 + n.relX + n.prelim + n.xSize / 2) / 2;
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: r,
446
+ prelim: n,
447
447
  lExt: t.lExt,
448
448
  lExtRelX: t.lExtRelX,
449
- rExt: n.rExt,
450
- rExtRelX: n.rExtRelX
449
+ rExt: i.rExt,
450
+ rExtRelX: i.rExtRelX
451
451
  });
452
452
  }
453
- }, ae = (e, t, n) => {
454
- for (; n !== null && e >= n.lowY; )
455
- n = n.next;
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: n
459
+ next: i
460
460
  };
461
- }, Q = ".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;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-dark .markmap{--markmap-code-bg: #1a1b26;--markmap-code-color: #ddd;--markmap-circle-open-bg: #444;--markmap-text-color: #eee}", me = Q, j = pt();
462
- function I(e) {
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 K(e, t) {
466
- const n = ft(e, t);
467
- return e[n];
465
+ function U(e, t) {
466
+ const i = kt(e, t);
467
+ return e[i];
468
468
  }
469
- function O(e) {
469
+ function T(e) {
470
470
  e.stopPropagation();
471
471
  }
472
- const le = new at();
473
- class tt {
474
- constructor(t, n) {
475
- this.options = U, this.revokers = [], this.handleZoom = (r) => {
476
- const { transform: o } = r;
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 = (r) => {
479
- r.preventDefault();
480
- const o = S(this.svg.node()), a = o.translate(
481
- -r.deltaX / o.k,
482
- -r.deltaY / o.k
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 = (r, o) => {
485
+ }, this.handleClick = (n, o) => {
486
486
  let a = this.options.toggleRecursively;
487
- (V ? r.metaKey : r.ctrlKey) && (a = !a), this.toggleNode(o, a);
488
- }, this.ensureView = this.ensureVisible, this.svg = t.datum ? t : ut(t), this.styleNode = this.svg.append("style"), this.zoom = mt().filter((r) => this.options.scrollForPan && r.type === "wheel" ? r.ctrlKey && !r.button : (!r.ctrlKey || r.type === "wheel") && !r.button).on("zoom", this.handleZoom), this.setOptions(n), this.state = {
489
- id: this.options.id || this.svg.attr("id") || lt(),
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.observer = new ResizeObserver(
492
- ct(() => {
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.revokers.push(
496
- le.tap(() => {
495
+ ), this._disposeList.push(
496
+ ue.tap(() => {
497
497
  this.setData();
498
498
  }),
499
- () => this.observer.disconnect()
499
+ () => this._observer.disconnect()
500
500
  );
501
501
  }
502
502
  getStyleContent() {
503
- const { style: t } = this.options, { id: n } = this.state, r = typeof t == "function" ? t(n) : "";
504
- return [this.options.embedGlobalCSS && Q, r].filter(Boolean).join(`
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
- ht(this.svg.attr("class"), "markmap", this.state.id)
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, n = !1) {
515
+ async toggleNode(t, i = !1) {
516
516
  var o, a;
517
- const r = (o = t.payload) != null && o.fold ? 0 : 1;
518
- n ? C(t, (l, s) => {
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: r
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 n = 0;
530
- const { color: r, initialExpandLevel: o } = this.options;
529
+ let i = 0;
530
+ const { color: n, initialExpandLevel: o } = this.options;
531
531
  let a = 0, l = 0;
532
- C(t, (s, c, p) => {
533
- var u, m, g, y;
534
- l += 1, s.children = (u = s.children) == null ? void 0 : u.map((x) => ({ ...x })), n += 1, s.state = {
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: n,
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 = [(m = p == null ? void 0 : p.state) == null ? void 0 : m.id, s.state.id].filter(Boolean).join(".") + yt(s.content), s.state.path = [(g = p == null ? void 0 : p.state) == null ? void 0 : g.path, s.state.id].filter(Boolean).join("."), r(s);
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(v("g")).selectAll(
553
- v("foreignObject")
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: n, spacingVertical: r } = this.options, o = Z({}).children((s) => {
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 ? n * 2 : 0) + t];
565
- }).spacing((s, c) => s.parent === c.parent ? r : r * 2), a = o.hierarchy(this.state.data);
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: P(l, (s) => s.data.state.rect.x) || 0,
578
- y1: P(l, (s) => s.data.state.rect.y) || 0,
579
- x2: W(
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: W(
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, n) {
596
- n && this.setOptions(n), t && (this.state.data = t), this.state.data && (this._initializeData(this.state.data), this.updateStyle(), await this.renderData());
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: n, autoFit: r, color: o, maxWidth: a } = this.options, l = this.state.data;
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
- C(l, (i, d, f) => {
611
+ R(l, (r, d, x) => {
603
612
  var E;
604
- (E = i.payload) != null && E.fold || d(), s[i.state.id] = i, f && (c[i.state.id] = f.state.id), p.push(i);
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 = {}, m = (i) => {
607
- !i || h[i.state.id] || C(i, (d, f) => {
608
- h[d.state.id] = i.state.id, f();
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
- }, g = (i) => u[h[i.state.id]] || l.state.rect, y = (i) => (s[h[i.state.id]] || l).state.rect;
611
- u[l.state.id] = l.state.rect, t && m(t);
612
- const x = this.g.selectAll(v("g")).each((i) => {
613
- u[i.state.id] = i.state.rect;
614
- }).data(p, (i) => i.state.key), b = x.enter().append("g").attr("data-depth", (i) => i.state.depth).attr("data-path", (i) => i.state.path).each((i) => {
615
- m(s[c[i.state.id]]);
616
- }), k = x.exit().each((i) => {
617
- m(s[c[i.state.id]]);
618
- }), z = x.merge(b).attr(
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
- (i) => {
631
+ (r) => {
621
632
  var d;
622
- return ["markmap-node", ((d = i.payload) == null ? void 0 : d.fold) && "markmap-fold"].filter(Boolean).join(" ");
633
+ return ["markmap-node", ((d = r.payload) == null ? void 0 : d.fold) && "markmap-fold"].filter(Boolean).join(" ");
623
634
  }
624
- ), B = z.selectAll(v("line")).data(
625
- (i) => [i],
626
- (i) => i.state.key
627
- ), F = B.enter().append("line").attr("stroke", (i) => o(i)).attr("stroke-width", 0), $ = B.merge(F), T = z.selectAll(v("circle")).data(
628
- (i) => {
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 = i.children) != null && d.length ? [i] : [];
641
+ return (d = r.children) != null && d.length ? [r] : [];
631
642
  },
632
- (i) => i.state.key
633
- ), D = T.enter().append("circle").attr("stroke-width", 0).attr("r", 0).on("click", (i, d) => this.handleClick(i, d)).on("mousedown", O).merge(T).attr("stroke", (i) => o(i)).attr(
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
- (i) => {
646
+ (r) => {
636
647
  var d;
637
- return (d = i.payload) != null && d.fold && i.children ? o(i) : "var(--markmap-circle-open-bg)";
648
+ return (d = r.payload) != null && d.fold && r.children ? o(r) : "var(--markmap-circle-open-bg)";
638
649
  }
639
- ), N = this.observer, _ = z.selectAll(v("foreignObject")).data(
640
- (i) => [i],
641
- (i) => i.state.key
642
- ), X = _.enter().append("foreignObject").attr("class", "markmap-foreign").attr("x", n).attr("y", 0).style("opacity", 0).on("mousedown", O).on("dblclick", O);
643
- X.append("xhtml:div").append("xhtml:div").html((i) => i.content).attr("xmlns", "http://www.w3.org/1999/xhtml"), X.each(function() {
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 i = (d = this.firstChild) == null ? void 0 : d.firstChild;
646
- N.observe(i);
656
+ const r = (d = this.firstChild) == null ? void 0 : d.firstChild;
657
+ N.observe(r);
647
658
  });
648
- const H = k.selectAll(
649
- v("foreignObject")
659
+ const P = C.selectAll(
660
+ k("foreignObject")
650
661
  );
651
- H.each(function() {
662
+ P.each(function() {
652
663
  var d;
653
- const i = (d = this.firstChild) == null ? void 0 : d.firstChild;
654
- N.unobserve(i);
664
+ const r = (d = this.firstChild) == null ? void 0 : d.firstChild;
665
+ N.unobserve(r);
655
666
  });
656
- const L = X.merge(_), et = p.flatMap(
657
- (i) => {
667
+ const W = _.merge(I), it = p.flatMap(
668
+ (r) => {
658
669
  var d;
659
- return (d = i.payload) != null && d.fold ? [] : i.children.map((f) => ({ source: i, target: f }));
670
+ return (d = r.payload) != null && d.fold ? [] : r.children.map((x) => ({ source: r, target: x }));
660
671
  }
661
- ), M = this.g.selectAll(v("path")).data(et, (i) => i.target.state.key), rt = M.exit(), nt = M.enter().insert("path", "g").attr("class", "markmap-link").attr("data-depth", (i) => i.target.state.depth).attr("data-path", (i) => i.target.state.path).attr("d", (i) => {
662
- const d = g(i.target), f = [
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 j({ source: f, target: f });
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", (i) => {
672
- const d = g(i);
673
- return `translate(${d.x + d.width - i.state.rect.width},${d.y + d.height - i.state.rect.height})`;
674
- }), this.transition(k).attr("transform", (i) => {
675
- const d = y(i), f = d.x + d.width - i.state.rect.width, E = d.y + d.height - i.state.rect.height;
676
- return `translate(${f},${E})`;
677
- }).remove(), this.transition(z).attr(
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
- (i) => `translate(${i.state.rect.x},${i.state.rect.y})`
690
+ (r) => `translate(${r.state.rect.x},${r.state.rect.y})`
680
691
  );
681
- const st = k.selectAll(
682
- v("line")
692
+ const at = C.selectAll(
693
+ k("line")
683
694
  );
684
- this.transition(st).attr("x1", (i) => i.state.rect.width).attr("stroke-width", 0), F.attr("x1", (i) => i.state.rect.width).attr("x2", (i) => i.state.rect.width), $.attr("y1", (i) => i.state.rect.height).attr("y2", (i) => i.state.rect.height), this.transition($).attr("x1", -1).attr("x2", (i) => i.state.rect.width + 2).attr("stroke", (i) => o(i)).attr("stroke-width", I);
685
- const it = k.selectAll(
686
- v("circle")
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(it).attr("r", 0).attr("stroke-width", 0), D.attr("cx", (i) => i.state.rect.width).attr("cy", (i) => i.state.rect.height), this.transition(D).attr("r", 6).attr("stroke-width", "1.5"), this.transition(H).style("opacity", 0), L.attr("width", (i) => Math.max(0, i.state.rect.width - n * 2)).attr("height", (i) => i.state.rect.height), this.transition(L).style("opacity", 1), this.transition(rt).attr("d", (i) => {
689
- const d = y(i.target), f = [
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 j({ source: f, target: f });
694
- }).attr("stroke-width", 0).remove(), this.transition(nt).attr("stroke", (i) => o(i.target)).attr("stroke-width", (i) => I(i.target)).attr("d", (i) => {
695
- const d = i.source, f = i.target, E = [
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
- ], ot = [
699
- f.state.rect.x,
700
- f.state.rect.y + f.state.rect.height
709
+ ], ct = [
710
+ x.state.rect.x,
711
+ x.state.rect.y + x.state.rect.height
701
712
  ];
702
- return j({ source: E, target: ot });
703
- }), r && this.fit();
713
+ return A({ source: E, target: ct });
714
+ }), n && this.fit();
704
715
  }
705
716
  transition(t) {
706
- const { duration: n } = this.options;
707
- return t.transition().duration(n);
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 n = this.svg.node(), { width: r, height: o } = n.getBoundingClientRect(), { fitRatio: a } = this.options, { x1: l, y1: s, x2: c, y2: p } = this.state.rect, h = c - l, u = p - s, m = Math.min(
714
- r / h * a,
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
- ), g = gt.translate(
718
- (r - h * m) / 2 - l * m,
719
- (o - u * m) / 2 - s * m
720
- ).scale(m);
721
- return this.transition(this.svg).call(this.zoom.transform, g).end().catch(w);
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 n;
725
- return this.g.selectAll(v("g")).each(function(o) {
726
- o === t && (n = {
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
- }), n;
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, n) {
746
+ async ensureVisible(t, i) {
736
747
  var b;
737
- const r = (b = this.findElement(t)) == null ? void 0 : b.data;
738
- if (!r) return;
739
- const o = this.svg.node(), a = o.getBoundingClientRect(), l = S(o), [s, c] = [
740
- r.state.rect.x,
741
- r.state.rect.x + r.state.rect.width + 2
742
- ].map((k) => k * l.k + l.x), [p, h] = [
743
- r.state.rect.y,
744
- r.state.rect.y + r.state.rect.height
745
- ].map((k) => k * l.k + l.y), u = {
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
- ...n
751
- }, m = [u.left - s, a.width - u.right - c], g = [u.top - p, a.height - u.bottom - h], y = m[0] * m[1] > 0 ? K(m, Math.abs) / l.k : 0, x = g[0] * g[1] > 0 ? K(g, Math.abs) / l.k : 0;
752
- if (y || x) {
753
- const k = l.translate(y, x);
754
- return this.transition(this.svg).call(this.zoom.transform, k).end().catch(w);
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, n) {
768
+ async centerNode(t, i) {
758
769
  var y;
759
- const r = (y = this.findElement(t)) == null ? void 0 : y.data;
760
- if (!r) return;
761
- const o = this.svg.node(), a = o.getBoundingClientRect(), l = S(o), s = (r.state.rect.x + r.state.rect.width / 2) * l.k + l.x, c = (r.state.rect.y + r.state.rect.height / 2) * l.k + l.y, p = {
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
- ...n
767
- }, h = (p.left + a.width - p.right) / 2, u = (p.top + a.height - p.bottom) / 2, m = (h - s) / l.k, g = (u - c) / l.k;
768
- if (m || g) {
769
- const x = l.translate(m, g);
770
- return this.transition(this.svg).call(this.zoom.transform, x).end().catch(w);
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 n = this.svg.node(), { width: r, height: o } = n.getBoundingClientRect(), a = r / 2, l = o / 2, s = S(n), c = s.translate(
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(w);
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.revokers.forEach((t) => {
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, n, r = null) {
789
- const o = new tt(t, n);
790
- return r && o.setData(r).then(() => {
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
- tt as Markmap,
797
- v as childSelector,
798
- xt as defaultColorFn,
799
- U as defaultOptions,
800
- ue as deriveOptions,
801
- me as globalCSS,
802
- V as isMacintosh,
803
- xe as loadCSS,
804
- ye as loadJS,
805
- le as refreshHook,
806
- yt as simpleHash
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
@@ -2,6 +2,7 @@ import { INode } from 'markmap-common';
2
2
  export interface IMarkmapState {
3
3
  id: string;
4
4
  data?: INode;
5
+ highlight?: INode;
5
6
  rect: {
6
7
  x1: number;
7
8
  x2: number;
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
- revokers: (() => void)[];
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-alpha.6+cea75c9",
3
+ "version": "0.18.5-alpha.7+41488b9",
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-alpha.6+cea75c9"
49
+ "markmap-common": "0.18.5-alpha.7+41488b9"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "markmap-common": "*"
53
53
  },
54
- "gitHead": "cea75c9906a30ddf515f94bd6ad61d6c9ca4035a"
54
+ "gitHead": "41488b9988a1f49f7dadc029ef6be18fed981cac"
55
55
  }