markmap-view 0.16.0 → 0.16.3-web.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1154,7 +1154,7 @@
1154
1154
  };
1155
1155
  };
1156
1156
  const containerCSS = "/* used for pre-rendering to get the size of each node */\n.markmap-container {\n position: absolute;\n width: 0;\n height: 0;\n top: -100px;\n left: -100px;\n overflow: hidden;\n}\n.markmap-container > .markmap-foreign {\n display: inline-block;\n }\n/* first-child for line wrapping, last-child for max-width detection */\n.markmap-container > .markmap-foreign > div:last-child,\n \n .markmap-container > .markmap-foreign > div:last-child :not(pre) {\n white-space: nowrap;\n }\n.markmap-container > .markmap-foreign > div:last-child code {\n white-space: inherit;\n }\n";
1157
- const css = ".markmap {\n --markmap-max-width: none;\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\n font: var(--markmap-font);\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 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-testing-max {\n max-width: var(--markmap-max-width);\n }\n\n .markmap-foreign-testing-max img {\n max-width: var(--markmap-max-width);\n max-height: none;\n }\n";
1157
+ const css = ".markmap {\n --markmap-max-width: none;\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-testing-max {\n max-width: var(--markmap-max-width);\n }\n\n .markmap-foreign-testing-max img {\n max-width: var(--markmap-max-width);\n max-height: none;\n }\n\n.markmap-dark .markmap {\n --markmap-circle-open-bg: #444;\n --markmap-text-color: #eee;\n}\n";
1158
1158
  const globalCSS = css;
1159
1159
  function linkWidth(nodeData) {
1160
1160
  const data = nodeData.data;
@@ -1462,7 +1462,7 @@
1462
1462
  "fill",
1463
1463
  (d) => {
1464
1464
  var _a;
1465
- return ((_a = d.data.payload) == null ? void 0 : _a.fold) && d.data.children ? color(d.data) : "#fff";
1465
+ return ((_a = d.data.payload) == null ? void 0 : _a.fold) && d.data.children ? color(d.data) : "var(--markmap-circle-open-bg)";
1466
1466
  }
1467
1467
  );
1468
1468
  const foreignObject = nodeMerge.selectAll(
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Hook as st, getId as at, debounce as lt, addClass as ct, walkTree as T, childSelector as C, noop as M } from "markmap-common";
2
2
  import { loadCSS as Ce, loadJS as we } from "markmap-common";
3
- import { scaleOrdinal as V, schemeCategory10 as ht, zoomTransform as A, select as dt, zoom as ut, linkHorizontal as pt, min as H, max as L, zoomIdentity as ft, minIndex as mt } from "d3";
3
+ import { scaleOrdinal as V, schemeCategory10 as ht, zoomTransform as A, select as dt, zoom as ut, linkHorizontal as pt, min as H, max as L, zoomIdentity as mt, minIndex as ft } from "d3";
4
4
  const K = typeof navigator < "u" && navigator.userAgent.includes("Macintosh"), gt = V(ht), P = {
5
5
  autoFit: !1,
6
6
  color: (e) => {
@@ -22,12 +22,12 @@ const K = typeof navigator < "u" && navigator.userAgent.includes("Macintosh"), g
22
22
  toggleRecursively: !1
23
23
  };
24
24
  function Se(e) {
25
- const t = {}, n = { ...e }, { color: i, colorFreezeLevel: o } = n;
26
- if ((i == null ? void 0 : i.length) === 1) {
27
- const s = i[0];
25
+ const t = {}, n = { ...e }, { color: r, colorFreezeLevel: o } = n;
26
+ if ((r == null ? void 0 : r.length) === 1) {
27
+ const s = r[0];
28
28
  t.color = () => s;
29
- } else if (i != null && i.length) {
30
- const s = V(i);
29
+ } else if (r != null && r.length) {
30
+ const s = V(r);
31
31
  t.color = (l) => s(`${l.state.path}`);
32
32
  }
33
33
  if (o) {
@@ -78,27 +78,27 @@ function I(e, t) {
78
78
  Array.isArray(t) || (t = [t]), t = t.filter(Boolean), t.length && e.append(...t);
79
79
  }
80
80
  function Et(e, t, n) {
81
- for (const i in t)
82
- if (!(i === "key" || i === "children" || i === "ref"))
83
- if (i === "dangerouslySetInnerHTML")
84
- e.innerHTML = t[i].__html;
85
- else if (i === "innerHTML" || i === "textContent" || i === "innerText" || i === "value" && ["textarea", "select"].includes(e.tagName)) {
86
- const o = t[i];
87
- o != null && (e[i] = o);
81
+ for (const r in t)
82
+ if (!(r === "key" || r === "children" || r === "ref"))
83
+ if (r === "dangerouslySetInnerHTML")
84
+ e.innerHTML = t[r].__html;
85
+ else if (r === "innerHTML" || r === "textContent" || r === "innerText" || r === "value" && ["textarea", "select"].includes(e.tagName)) {
86
+ const o = t[r];
87
+ o != null && (e[r] = o);
88
88
  } else
89
- i.startsWith("on") ? e[i.toLowerCase()] = t[i] : wt(e, i, t[i], n.isSvg);
89
+ r.startsWith("on") ? e[r.toLowerCase()] = t[r] : wt(e, r, t[r], n.isSvg);
90
90
  }
91
91
  const Ct = {
92
92
  className: "class",
93
93
  labelFor: "for"
94
94
  };
95
- function wt(e, t, n, i) {
95
+ function wt(e, t, n, r) {
96
96
  if (t = Ct[t] || t, n === !0)
97
97
  e.setAttribute(t, "");
98
98
  else if (n === !1)
99
99
  e.removeAttribute(t);
100
100
  else {
101
- const o = i ? yt[t] : void 0;
101
+ const o = r ? yt[t] : void 0;
102
102
  o !== void 0 ? e.setAttributeNS(o, t, n) : e.setAttribute(t, n);
103
103
  }
104
104
  }
@@ -116,17 +116,17 @@ function B(e, t = zt) {
116
116
  if (St(e)) {
117
117
  const {
118
118
  type: n,
119
- props: i
119
+ props: r
120
120
  } = e;
121
121
  if (n === bt) {
122
122
  const a = document.createDocumentFragment();
123
- if (i.children) {
124
- const c = $(i.children, t);
123
+ if (r.children) {
124
+ const c = $(r.children, t);
125
125
  I(a, c);
126
126
  }
127
127
  return a;
128
128
  }
129
- const o = n(i);
129
+ const o = n(r);
130
130
  return B(o, t);
131
131
  }
132
132
  if (kt(e))
@@ -134,14 +134,14 @@ function B(e, t = zt) {
134
134
  if (vt(e)) {
135
135
  let n;
136
136
  const {
137
- type: i,
137
+ type: r,
138
138
  props: o
139
139
  } = e;
140
- if (!t.isSvg && i === "svg" && (t = Object.assign({}, t, {
140
+ if (!t.isSvg && r === "svg" && (t = Object.assign({}, t, {
141
141
  isSvg: !0
142
- })), t.isSvg ? n = document.createElementNS(xt, i) : n = document.createElement(i), Et(n, o, t), o.children) {
142
+ })), t.isSvg ? n = document.createElementNS(xt, r) : n = document.createElement(r), Et(n, o, t), o.children) {
143
143
  let c = t;
144
- t.isSvg && i === "foreignObject" && (c = Object.assign({}, c, {
144
+ t.isSvg && r === "foreignObject" && (c = Object.assign({}, c, {
145
145
  isSvg: !1
146
146
  }));
147
147
  const s = $(o.children, c);
@@ -158,47 +158,47 @@ function O(e) {
158
158
  return B(e);
159
159
  }
160
160
  function jt(e) {
161
- var t = 0, n = e.children, i = n && n.length;
162
- if (!i)
161
+ var t = 0, n = e.children, r = n && n.length;
162
+ if (!r)
163
163
  t = 1;
164
164
  else
165
- for (; --i >= 0; )
166
- t += n[i].value;
165
+ for (; --r >= 0; )
166
+ t += n[r].value;
167
167
  e.value = t;
168
168
  }
169
169
  function Nt() {
170
170
  return this.eachAfter(jt);
171
171
  }
172
172
  function Rt(e) {
173
- var t = this, n, i = [t], o, a, c;
173
+ var t = this, n, r = [t], o, a, c;
174
174
  do
175
- for (n = i.reverse(), i = []; t = n.pop(); )
175
+ for (n = r.reverse(), r = []; t = n.pop(); )
176
176
  if (e(t), o = t.children, o)
177
177
  for (a = 0, c = o.length; a < c; ++a)
178
- i.push(o[a]);
179
- while (i.length);
178
+ r.push(o[a]);
179
+ while (r.length);
180
180
  return this;
181
181
  }
182
182
  function Tt(e) {
183
- for (var t = this, n = [t], i, o; t = n.pop(); )
184
- if (e(t), i = t.children, i)
185
- for (o = i.length - 1; o >= 0; --o)
186
- n.push(i[o]);
183
+ for (var t = this, n = [t], r, o; t = n.pop(); )
184
+ if (e(t), r = t.children, r)
185
+ for (o = r.length - 1; o >= 0; --o)
186
+ n.push(r[o]);
187
187
  return this;
188
188
  }
189
189
  function Mt(e) {
190
- for (var t = this, n = [t], i = [], o, a, c; t = n.pop(); )
191
- if (i.push(t), o = t.children, o)
190
+ for (var t = this, n = [t], r = [], o, a, c; t = n.pop(); )
191
+ if (r.push(t), o = t.children, o)
192
192
  for (a = 0, c = o.length; a < c; ++a)
193
193
  n.push(o[a]);
194
- for (; t = i.pop(); )
194
+ for (; t = r.pop(); )
195
195
  e(t);
196
196
  return this;
197
197
  }
198
198
  function At(e) {
199
199
  return this.eachAfter(function(t) {
200
- for (var n = +e(t.data) || 0, i = t.children, o = i && i.length; --o >= 0; )
201
- n += i[o].value;
200
+ for (var n = +e(t.data) || 0, r = t.children, o = r && r.length; --o >= 0; )
201
+ n += r[o].value;
202
202
  t.value = n;
203
203
  });
204
204
  }
@@ -208,18 +208,18 @@ function _t(e) {
208
208
  });
209
209
  }
210
210
  function Ot(e) {
211
- for (var t = this, n = Dt(t, e), i = [t]; t !== n; )
212
- t = t.parent, i.push(t);
213
- for (var o = i.length; e !== n; )
214
- i.splice(o, 0, e), e = e.parent;
215
- return i;
211
+ for (var t = this, n = Dt(t, e), r = [t]; t !== n; )
212
+ t = t.parent, r.push(t);
213
+ for (var o = r.length; e !== n; )
214
+ r.splice(o, 0, e), e = e.parent;
215
+ return r;
216
216
  }
217
217
  function Dt(e, t) {
218
218
  if (e === t)
219
219
  return e;
220
- var n = e.ancestors(), i = t.ancestors(), o = null;
221
- for (e = n.pop(), t = i.pop(); e === t; )
222
- o = e, e = n.pop(), t = i.pop();
220
+ var n = e.ancestors(), r = t.ancestors(), o = null;
221
+ for (e = n.pop(), t = r.pop(); e === t; )
222
+ o = e, e = n.pop(), t = r.pop();
223
223
  return o;
224
224
  }
225
225
  function $t() {
@@ -246,9 +246,9 @@ function Ht() {
246
246
  }), t;
247
247
  }
248
248
  function F(e, t) {
249
- var n = new N(e), i = +e.value && (n.value = e.value), o, a = [n], c, s, l, p;
249
+ var n = new N(e), r = +e.value && (n.value = e.value), o, a = [n], c, s, l, p;
250
250
  for (t == null && (t = It); o = a.pop(); )
251
- if (i && (o.value = +o.data.value), (s = t(o.data)) && (p = s.length))
251
+ if (r && (o.value = +o.data.value), (s = t(o.data)) && (p = s.length))
252
252
  for (o.children = new Array(p), l = p - 1; l >= 0; --l)
253
253
  a.push(c = o.children[l] = new N(s[l])), c.parent = o, c.depth = o.depth + 1;
254
254
  return n.eachBefore(Yt);
@@ -318,7 +318,7 @@ const Vt = "d3-flextree", Kt = "2.1.2", Pt = "build/d3-flextree.js", Ut = "index
318
318
  prepare: "npm-run-all clean build lint test"
319
319
  }, ne = {
320
320
  "d3-hierarchy": "^1.1.5"
321
- }, ie = {
321
+ }, re = {
322
322
  "babel-plugin-external-helpers": "^6.22.0",
323
323
  "babel-preset-es2015-rollup": "^3.0.0",
324
324
  d3: "^4.13.0",
@@ -334,7 +334,7 @@ const Vt = "d3-flextree", Kt = "2.1.2", Pt = "build/d3-flextree.js", Ut = "index
334
334
  "rollup-plugin-node-resolve": "^3.0.2",
335
335
  "rollup-plugin-uglify": "^3.0.0",
336
336
  "uglify-es": "^3.3.9"
337
- }, re = {
337
+ }, ie = {
338
338
  name: Vt,
339
339
  version: Kt,
340
340
  main: Pt,
@@ -348,8 +348,8 @@ const Vt = "d3-flextree", Kt = "2.1.2", Pt = "build/d3-flextree.js", Ut = "index
348
348
  repository: te,
349
349
  scripts: ee,
350
350
  dependencies: ne,
351
- devDependencies: ie
352
- }, { version: oe } = re, se = Object.freeze({
351
+ devDependencies: re
352
+ }, { version: oe } = ie, se = Object.freeze({
353
353
  children: (e) => e.children,
354
354
  nodeSize: (e) => e.data.size,
355
355
  spacing: 0
@@ -360,7 +360,7 @@ function q(e) {
360
360
  const l = t[s];
361
361
  return typeof l == "function" ? l : () => l;
362
362
  }
363
- function i(s) {
363
+ function r(s) {
364
364
  const l = c(a(), s, (p) => p.children);
365
365
  return l.update(), l.data;
366
366
  }
@@ -495,26 +495,26 @@ function q(e) {
495
495
  height: 0,
496
496
  length: 1
497
497
  });
498
- const f = p(u) || [];
499
- return x.children = f.length === 0 ? null : f.map((y) => h(y, x)), x.children && Object.assign(x, x.children.reduce(
500
- (y, m) => ({
501
- height: Math.max(y.height, m.height + 1),
502
- length: y.length + m.length
498
+ const m = p(u) || [];
499
+ return x.children = m.length === 0 ? null : m.map((y) => h(y, x)), x.children && Object.assign(x, x.children.reduce(
500
+ (y, f) => ({
501
+ height: Math.max(y.height, f.height + 1),
502
+ length: y.length + f.length
503
503
  }),
504
504
  x
505
505
  )), x;
506
506
  };
507
507
  return h(l, null);
508
508
  }
509
- return Object.assign(i, {
509
+ return Object.assign(r, {
510
510
  nodeSize(s) {
511
- return arguments.length ? (t.nodeSize = s, i) : t.nodeSize;
511
+ return arguments.length ? (t.nodeSize = s, r) : t.nodeSize;
512
512
  },
513
513
  spacing(s) {
514
- return arguments.length ? (t.spacing = s, i) : t.spacing;
514
+ return arguments.length ? (t.spacing = s, r) : t.spacing;
515
515
  },
516
516
  children(s) {
517
- return arguments.length ? (t.children = s, i) : t.children;
517
+ return arguments.length ? (t.children = s, r) : t.children;
518
518
  },
519
519
  hierarchy(s, l) {
520
520
  const p = typeof l > "u" ? t.children : l;
@@ -522,34 +522,34 @@ function q(e) {
522
522
  },
523
523
  dump(s) {
524
524
  const l = n("nodeSize"), p = (h) => (u) => {
525
- const g = h + " ", x = h + " ", { x: f, y } = u, m = l(u), k = u.children || [], v = k.length === 0 ? " " : `,${g}children: [${x}${k.map(p(x)).join(x)}${g}],${h}`;
526
- return `{ size: [${m.join(", ")}],${g}x: ${f}, y: ${y}${v}},`;
525
+ const g = h + " ", x = h + " ", { x: m, y } = u, f = l(u), k = u.children || [], v = k.length === 0 ? " " : `,${g}children: [${x}${k.map(p(x)).join(x)}${g}],${h}`;
526
+ return `{ size: [${f.join(", ")}],${g}x: ${m}, y: ${y}${v}},`;
527
527
  };
528
528
  return p(`
529
529
  `)(s);
530
530
  }
531
- }), i;
531
+ }), r;
532
532
  }
533
533
  q.version = oe;
534
- const J = (e, t = 0) => (e.y = t, (e.children || []).reduce((n, i) => {
534
+ const J = (e, t = 0) => (e.y = t, (e.children || []).reduce((n, r) => {
535
535
  const [o, a] = n;
536
- J(i, e.y + e.ySize);
537
- const c = (o === 0 ? i.lExt : i.rExt).bottom;
536
+ J(r, e.y + e.ySize);
537
+ const c = (o === 0 ? r.lExt : r.rExt).bottom;
538
538
  o !== 0 && le(e, o, a);
539
539
  const s = ge(c, o, a);
540
540
  return [o + 1, s];
541
- }, [0, null]), ae(e), me(e), e), Q = (e, t, n) => {
541
+ }, [0, null]), ae(e), fe(e), e), Q = (e, t, n) => {
542
542
  typeof t > "u" && (t = -e.relX - e.prelim, n = 0);
543
- const i = t + e.relX;
544
- return e.relX = i + e.prelim - n, e.prelim = 0, e.x = n + e.relX, (e.children || []).forEach((o) => Q(o, i, e.x)), e;
543
+ const r = t + e.relX;
544
+ return e.relX = r + e.prelim - n, e.prelim = 0, e.x = n + e.relX, (e.children || []).forEach((o) => Q(o, r, e.x)), e;
545
545
  }, ae = (e) => {
546
546
  (e.children || []).reduce((t, n) => {
547
- const [i, o] = t, a = i + n.shift, c = o + a + n.change;
547
+ const [r, o] = t, a = r + n.shift, c = o + a + n.change;
548
548
  return n.relX += c, [a, c];
549
549
  }, [0, 0]);
550
550
  }, le = (e, t, n) => {
551
- const i = e.children[t - 1], o = e.children[t];
552
- let a = i, c = i.relX, s = o, l = o.relX, p = !0;
551
+ const r = e.children[t - 1], o = e.children[t];
552
+ let a = r, c = r.relX, s = o, l = o.relX, p = !0;
553
553
  for (; a && s; ) {
554
554
  a.bottom > n.lowY && (n = n.next);
555
555
  const h = c + a.prelim - (l + s.prelim) + a.xSize / 2 + s.xSize / 2 + a.spacing(s);
@@ -557,30 +557,30 @@ const J = (e, t = 0) => (e.y = t, (e.children || []).reduce((n, i) => {
557
557
  const u = a.bottom, g = s.bottom;
558
558
  u <= g && (a = ue(a), a && (c += a.relX)), u >= g && (s = de(s), s && (l += s.relX));
559
559
  }
560
- !a && s ? pe(e, t, s, l) : a && !s && fe(e, t, a, c);
560
+ !a && s ? pe(e, t, s, l) : a && !s && me(e, t, a, c);
561
561
  }, ce = (e, t) => {
562
562
  e.relX += t, e.lExtRelX += t, e.rExtRelX += t;
563
- }, he = (e, t, n, i) => {
563
+ }, he = (e, t, n, r) => {
564
564
  const o = e.children[t], a = t - n;
565
565
  if (a > 1) {
566
- const c = i / a;
567
- e.children[n + 1].shift += c, o.shift -= c, o.change -= i - c;
566
+ const c = r / a;
567
+ e.children[n + 1].shift += c, o.shift -= c, o.change -= r - c;
568
568
  }
569
- }, de = (e) => e.hasChildren ? e.firstChild : e.lThr, ue = (e) => e.hasChildren ? e.lastChild : e.rThr, pe = (e, t, n, i) => {
569
+ }, de = (e) => e.hasChildren ? e.firstChild : e.lThr, ue = (e) => e.hasChildren ? e.lastChild : e.rThr, pe = (e, t, n, r) => {
570
570
  const o = e.firstChild, a = o.lExt, c = e.children[t];
571
571
  a.lThr = n;
572
- const s = i - n.relX - o.lExtRelX;
572
+ const s = r - n.relX - o.lExtRelX;
573
573
  a.relX += s, a.prelim -= s, o.lExt = c.lExt, o.lExtRelX = c.lExtRelX;
574
- }, fe = (e, t, n, i) => {
574
+ }, me = (e, t, n, r) => {
575
575
  const o = e.children[t], a = o.rExt, c = e.children[t - 1];
576
576
  a.rThr = n;
577
- const s = i - n.relX - o.rExtRelX;
577
+ const s = r - n.relX - o.rExtRelX;
578
578
  a.relX += s, a.prelim -= s, o.rExt = c.rExt, o.rExtRelX = c.rExtRelX;
579
- }, me = (e) => {
579
+ }, fe = (e) => {
580
580
  if (e.hasChildren) {
581
- const t = e.firstChild, n = e.lastChild, i = (t.prelim + t.relX - t.xSize / 2 + n.relX + n.prelim + n.xSize / 2) / 2;
581
+ const t = e.firstChild, n = e.lastChild, r = (t.prelim + t.relX - t.xSize / 2 + n.relX + n.prelim + n.xSize / 2) / 2;
582
582
  Object.assign(e, {
583
- prelim: i,
583
+ prelim: r,
584
584
  lExt: t.lExt,
585
585
  lExtRelX: t.lExtRelX,
586
586
  rExt: n.rExt,
@@ -595,13 +595,13 @@ const J = (e, t = 0) => (e.y = t, (e.children || []).reduce((n, i) => {
595
595
  index: t,
596
596
  next: n
597
597
  };
598
- }, xe = ".markmap-container{position:absolute;width:0;height:0;top:-100px;left:-100px;overflow:hidden}.markmap-container>.markmap-foreign{display:inline-block}.markmap-container>.markmap-foreign>div:last-child,.markmap-container>.markmap-foreign>div:last-child :not(pre){white-space:nowrap}.markmap-container>.markmap-foreign>div:last-child code{white-space:inherit}", tt = ".markmap{--markmap-max-width: none;--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;font:var(--markmap-font)}.markmap-link{fill:none}.markmap-node>circle{cursor:pointer}.markmap-foreign{display:inline-block}.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-testing-max{max-width:var(--markmap-max-width)}.markmap-foreign-testing-max img{max-width:var(--markmap-max-width);max-height:none}", be = tt;
598
+ }, xe = ".markmap-container{position:absolute;width:0;height:0;top:-100px;left:-100px;overflow:hidden}.markmap-container>.markmap-foreign{display:inline-block}.markmap-container>.markmap-foreign>div:last-child,.markmap-container>.markmap-foreign>div:last-child :not(pre){white-space:nowrap}.markmap-container>.markmap-foreign>div:last-child code{white-space:inherit}", tt = ".markmap{--markmap-max-width: none;--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-testing-max{max-width:var(--markmap-max-width)}.markmap-foreign-testing-max img{max-width:var(--markmap-max-width);max-height:none}.markmap-dark .markmap{--markmap-circle-open-bg: #444;--markmap-text-color: #eee}", be = tt;
599
599
  function W(e) {
600
600
  const t = e.data;
601
601
  return Math.max(4 - 2 * t.state.depth, 1.5);
602
602
  }
603
603
  function Y(e, t) {
604
- const n = mt(e, t);
604
+ const n = ft(e, t);
605
605
  return e[n];
606
606
  }
607
607
  function D(e) {
@@ -610,20 +610,20 @@ function D(e) {
610
610
  const ye = new st();
611
611
  class et {
612
612
  constructor(t, n) {
613
- this.options = P, this.revokers = [], this.imgCache = {}, this.handleZoom = (i) => {
614
- const { transform: o } = i;
613
+ this.options = P, this.revokers = [], this.imgCache = {}, this.handleZoom = (r) => {
614
+ const { transform: o } = r;
615
615
  this.g.attr("transform", o);
616
- }, this.handlePan = (i) => {
617
- i.preventDefault();
616
+ }, this.handlePan = (r) => {
617
+ r.preventDefault();
618
618
  const o = A(this.svg.node()), a = o.translate(
619
- -i.deltaX / o.k,
620
- -i.deltaY / o.k
619
+ -r.deltaX / o.k,
620
+ -r.deltaY / o.k
621
621
  );
622
622
  this.svg.call(this.zoom.transform, a);
623
- }, this.handleClick = (i, o) => {
623
+ }, this.handleClick = (r, o) => {
624
624
  let a = this.options.toggleRecursively;
625
- (K ? i.metaKey : i.ctrlKey) && (a = !a), this.toggleNode(o.data, a);
626
- }, this.svg = t.datum ? t : dt(t), this.styleNode = this.svg.append("style"), this.zoom = ut().filter((i) => this.options.scrollForPan && i.type === "wheel" ? i.ctrlKey && !i.button : (!i.ctrlKey || i.type === "wheel") && !i.button).on("zoom", this.handleZoom), this.setOptions(n), this.state = {
625
+ (K ? r.metaKey : r.ctrlKey) && (a = !a), this.toggleNode(o.data, a);
626
+ }, this.svg = t.datum ? t : dt(t), this.styleNode = this.svg.append("style"), this.zoom = ut().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 = {
627
627
  id: this.options.id || this.svg.attr("id") || at(),
628
628
  minX: 0,
629
629
  maxX: 0,
@@ -636,8 +636,8 @@ class et {
636
636
  );
637
637
  }
638
638
  getStyleContent() {
639
- const { style: t } = this.options, { id: n } = this.state, i = typeof t == "function" ? t(n) : "";
640
- return [this.options.embedGlobalCSS && tt, i].filter(Boolean).join(`
639
+ const { style: t } = this.options, { id: n } = this.state, r = typeof t == "function" ? t(n) : "";
640
+ return [this.options.embedGlobalCSS && tt, r].filter(Boolean).join(`
641
641
  `);
642
642
  }
643
643
  updateStyle() {
@@ -650,11 +650,11 @@ class et {
650
650
  }
651
651
  toggleNode(t, n = !1) {
652
652
  var o, a;
653
- const i = (o = t.payload) != null && o.fold ? 0 : 1;
653
+ const r = (o = t.payload) != null && o.fold ? 0 : 1;
654
654
  n ? T(t, (c, s) => {
655
655
  c.payload = {
656
656
  ...c.payload,
657
- fold: i
657
+ fold: r
658
658
  }, s();
659
659
  }) : t.payload = {
660
660
  ...t.payload,
@@ -663,7 +663,7 @@ class et {
663
663
  }
664
664
  initializeData(t) {
665
665
  let n = 0;
666
- const { color: i, nodeMinHeight: o, maxWidth: a, initialExpandLevel: c } = this.options, { id: s } = this.state, l = O(
666
+ const { color: r, nodeMinHeight: o, maxWidth: a, initialExpandLevel: c } = this.options, { id: s } = this.state, l = O(
667
667
  /* @__PURE__ */ j("div", { className: `markmap-container markmap ${s}-g` })
668
668
  ), p = O(
669
669
  /* @__PURE__ */ j("style", { children: [this.getStyleContent(), xe].join(`
@@ -672,50 +672,50 @@ class et {
672
672
  document.body.append(l, p);
673
673
  const h = a ? `--markmap-max-width: ${a}px` : "";
674
674
  let u = 0, g = 0;
675
- T(t, (f, y, m) => {
675
+ T(t, (m, y, f) => {
676
676
  var b, w, z;
677
- g += 1, f.children = (b = f.children) == null ? void 0 : b.map((E) => ({ ...E })), n += 1;
677
+ g += 1, m.children = (b = m.children) == null ? void 0 : b.map((E) => ({ ...E })), n += 1;
678
678
  const k = O(
679
679
  /* @__PURE__ */ j(
680
680
  "div",
681
681
  {
682
682
  className: "markmap-foreign markmap-foreign-testing-max",
683
683
  style: h,
684
- children: /* @__PURE__ */ j("div", { dangerouslySetInnerHTML: { __html: f.content } })
684
+ children: /* @__PURE__ */ j("div", { dangerouslySetInnerHTML: { __html: m.content } })
685
685
  }
686
686
  )
687
687
  );
688
- l.append(k), f.state = {
689
- ...f.state,
688
+ l.append(k), m.state = {
689
+ ...m.state,
690
690
  depth: g,
691
691
  id: n,
692
692
  el: k.firstChild
693
- }, f.state.path = [(w = m == null ? void 0 : m.state) == null ? void 0 : w.path, f.state.id].filter(Boolean).join("."), i(f);
694
- const v = ((z = f.payload) == null ? void 0 : z.fold) === 2;
695
- v ? u += 1 : (u || c >= 0 && f.state.depth >= c) && (f.payload = { ...f.payload, fold: 1 }), y(), v && (u -= 1), g -= 1;
693
+ }, m.state.path = [(w = f == null ? void 0 : f.state) == null ? void 0 : w.path, m.state.id].filter(Boolean).join("."), r(m);
694
+ const v = ((z = m.payload) == null ? void 0 : z.fold) === 2;
695
+ v ? u += 1 : (u || c >= 0 && m.state.depth >= c) && (m.payload = { ...m.payload, fold: 1 }), y(), v && (u -= 1), g -= 1;
696
696
  });
697
697
  const x = Array.from(l.childNodes).map(
698
- (f) => f.firstChild
698
+ (m) => m.firstChild
699
699
  );
700
- this._checkImages(l), x.forEach((f) => {
700
+ this._checkImages(l), x.forEach((m) => {
701
701
  var y;
702
- (y = f.parentNode) == null || y.append(f.cloneNode(!0));
703
- }), T(t, (f, y, m) => {
702
+ (y = m.parentNode) == null || y.append(m.cloneNode(!0));
703
+ }), T(t, (m, y, f) => {
704
704
  var b;
705
- const k = f.state, v = k.el.getBoundingClientRect();
706
- f.content = k.el.innerHTML, k.size = [
705
+ const k = m.state, v = k.el.getBoundingClientRect();
706
+ m.content = k.el.innerHTML, k.size = [
707
707
  Math.ceil(v.width) + 1,
708
708
  Math.max(Math.ceil(v.height), o)
709
- ], k.key = [(b = m == null ? void 0 : m.state) == null ? void 0 : b.id, k.id].filter(Boolean).join(".") + // FIXME: find a way to check content hash
710
- f.content, y();
709
+ ], k.key = [(b = f == null ? void 0 : f.state) == null ? void 0 : b.id, k.id].filter(Boolean).join(".") + // FIXME: find a way to check content hash
710
+ m.content, y();
711
711
  }), l.remove(), p.remove();
712
712
  }
713
713
  _checkImages(t) {
714
714
  t.querySelectorAll("img").forEach((n) => {
715
715
  if (n.width)
716
716
  return;
717
- const i = this.imgCache[n.src];
718
- i != null && i[0] ? [n.width, n.height] = i : i || this._loadImage(n.src);
717
+ const r = this.imgCache[n.src];
718
+ r != null && r[0] ? [n.width, n.height] = r : r || this._loadImage(n.src);
719
719
  });
720
720
  }
721
721
  _loadImage(t) {
@@ -737,115 +737,115 @@ class et {
737
737
  renderData(t) {
738
738
  if (!this.state.data)
739
739
  return;
740
- const { spacingHorizontal: n, paddingX: i, spacingVertical: o, autoFit: a, color: c } = this.options, s = q({}).children((r) => {
740
+ const { spacingHorizontal: n, paddingX: r, spacingVertical: o, autoFit: a, color: c } = this.options, s = q({}).children((i) => {
741
741
  var d;
742
- if (!((d = r.payload) != null && d.fold))
743
- return r.children;
744
- }).nodeSize((r) => {
745
- const [d, S] = r.data.state.size;
746
- return [S, d + (d ? i * 2 : 0) + n];
747
- }).spacing((r, d) => r.parent === d.parent ? o : o * 2), l = s.hierarchy(this.state.data);
742
+ if (!((d = i.payload) != null && d.fold))
743
+ return i.children;
744
+ }).nodeSize((i) => {
745
+ const [d, S] = i.data.state.size;
746
+ return [S, d + (d ? r * 2 : 0) + n];
747
+ }).spacing((i, d) => i.parent === d.parent ? o : o * 2), l = s.hierarchy(this.state.data);
748
748
  s(l);
749
- const p = l.descendants().reverse(), h = l.links(), u = pt(), g = H(p, (r) => r.x - r.xSize / 2), x = L(p, (r) => r.x + r.xSize / 2), f = H(p, (r) => r.y), y = L(p, (r) => r.y + r.ySize - n);
749
+ const p = l.descendants().reverse(), h = l.links(), u = pt(), g = H(p, (i) => i.x - i.xSize / 2), x = L(p, (i) => i.x + i.xSize / 2), m = H(p, (i) => i.y), y = L(p, (i) => i.y + i.ySize - n);
750
750
  Object.assign(this.state, {
751
751
  minX: g,
752
752
  maxX: x,
753
- minY: f,
753
+ minY: m,
754
754
  maxY: y
755
755
  }), a && this.fit();
756
- const m = t && p.find((r) => r.data === t) || l, k = m.data.state.x0 ?? m.x, v = m.data.state.y0 ?? m.y, b = this.g.selectAll(
756
+ const f = t && p.find((i) => i.data === t) || l, k = f.data.state.x0 ?? f.x, v = f.data.state.y0 ?? f.y, b = this.g.selectAll(
757
757
  C("g")
758
- ).data(p, (r) => r.data.state.key), w = b.enter().append("g").attr("data-depth", (r) => r.data.state.depth).attr("data-path", (r) => r.data.state.path).attr(
758
+ ).data(p, (i) => i.data.state.key), w = b.enter().append("g").attr("data-depth", (i) => i.data.state.depth).attr("data-path", (i) => i.data.state.path).attr(
759
759
  "transform",
760
- (r) => `translate(${v + m.ySize - r.ySize},${k + m.xSize / 2 - r.xSize})`
760
+ (i) => `translate(${v + f.ySize - i.ySize},${k + f.xSize / 2 - i.xSize})`
761
761
  ), z = this.transition(b.exit());
762
- z.select("line").attr("x1", (r) => r.ySize - n).attr("x2", (r) => r.ySize - n), z.select("foreignObject").style("opacity", 0), z.attr(
762
+ z.select("line").attr("x1", (i) => i.ySize - n).attr("x2", (i) => i.ySize - n), z.select("foreignObject").style("opacity", 0), z.attr(
763
763
  "transform",
764
- (r) => `translate(${m.y + m.ySize - r.ySize},${m.x + m.xSize / 2 - r.xSize})`
764
+ (i) => `translate(${f.y + f.ySize - i.ySize},${f.x + f.xSize / 2 - i.xSize})`
765
765
  ).remove();
766
766
  const E = b.merge(w).attr(
767
767
  "class",
768
- (r) => {
768
+ (i) => {
769
769
  var d;
770
- return ["markmap-node", ((d = r.data.payload) == null ? void 0 : d.fold) && "markmap-fold"].filter(Boolean).join(" ");
770
+ return ["markmap-node", ((d = i.data.payload) == null ? void 0 : d.fold) && "markmap-fold"].filter(Boolean).join(" ");
771
771
  }
772
772
  );
773
773
  this.transition(E).attr(
774
774
  "transform",
775
- (r) => `translate(${r.y},${r.x - r.xSize / 2})`
775
+ (i) => `translate(${i.y},${i.x - i.xSize / 2})`
776
776
  );
777
777
  const nt = E.selectAll(
778
778
  C("line")
779
779
  ).data(
780
- (r) => [r],
781
- (r) => r.data.state.key
780
+ (i) => [i],
781
+ (i) => i.data.state.key
782
782
  ).join(
783
- (r) => r.append("line").attr("x1", (d) => d.ySize - n).attr("x2", (d) => d.ySize - n),
784
- (r) => r,
785
- (r) => r.remove()
783
+ (i) => i.append("line").attr("x1", (d) => d.ySize - n).attr("x2", (d) => d.ySize - n),
784
+ (i) => i,
785
+ (i) => i.remove()
786
786
  );
787
- this.transition(nt).attr("x1", -1).attr("x2", (r) => r.ySize - n + 2).attr("y1", (r) => r.xSize).attr("y2", (r) => r.xSize).attr("stroke", (r) => c(r.data)).attr("stroke-width", W);
788
- const it = E.selectAll(
787
+ this.transition(nt).attr("x1", -1).attr("x2", (i) => i.ySize - n + 2).attr("y1", (i) => i.xSize).attr("y2", (i) => i.xSize).attr("stroke", (i) => c(i.data)).attr("stroke-width", W);
788
+ const rt = E.selectAll(
789
789
  C("circle")
790
790
  ).data(
791
- (r) => {
791
+ (i) => {
792
792
  var d;
793
- return (d = r.data.children) != null && d.length ? [r] : [];
793
+ return (d = i.data.children) != null && d.length ? [i] : [];
794
794
  },
795
- (r) => r.data.state.key
795
+ (i) => i.data.state.key
796
796
  ).join(
797
- (r) => r.append("circle").attr("stroke-width", "1.5").attr("cx", (d) => d.ySize - n).attr("cy", (d) => d.xSize).attr("r", 0).on("click", (d, S) => this.handleClick(d, S)).on("mousedown", D),
798
- (r) => r,
799
- (r) => r.remove()
797
+ (i) => i.append("circle").attr("stroke-width", "1.5").attr("cx", (d) => d.ySize - n).attr("cy", (d) => d.xSize).attr("r", 0).on("click", (d, S) => this.handleClick(d, S)).on("mousedown", D),
798
+ (i) => i,
799
+ (i) => i.remove()
800
800
  );
801
- this.transition(it).attr("r", 6).attr("cx", (r) => r.ySize - n).attr("cy", (r) => r.xSize).attr("stroke", (r) => c(r.data)).attr(
801
+ this.transition(rt).attr("r", 6).attr("cx", (i) => i.ySize - n).attr("cy", (i) => i.xSize).attr("stroke", (i) => c(i.data)).attr(
802
802
  "fill",
803
- (r) => {
803
+ (i) => {
804
804
  var d;
805
- return (d = r.data.payload) != null && d.fold && r.data.children ? c(r.data) : "#fff";
805
+ return (d = i.data.payload) != null && d.fold && i.data.children ? c(i.data) : "var(--markmap-circle-open-bg)";
806
806
  }
807
807
  );
808
- const rt = E.selectAll(
808
+ const it = E.selectAll(
809
809
  C("foreignObject")
810
810
  ).data(
811
- (r) => [r],
812
- (r) => r.data.state.key
811
+ (i) => [i],
812
+ (i) => i.data.state.key
813
813
  ).join(
814
- (r) => {
815
- const d = r.append("foreignObject").attr("class", "markmap-foreign").attr("x", i).attr("y", 0).style("opacity", 0).on("mousedown", D).on("dblclick", D);
814
+ (i) => {
815
+ const d = i.append("foreignObject").attr("class", "markmap-foreign").attr("x", r).attr("y", 0).style("opacity", 0).on("mousedown", D).on("dblclick", D);
816
816
  return d.append("xhtml:div").select(function(R) {
817
817
  const X = R.data.state.el.cloneNode(!0);
818
818
  return this.replaceWith(X), X;
819
819
  }).attr("xmlns", "http://www.w3.org/1999/xhtml"), d;
820
820
  },
821
- (r) => r,
822
- (r) => r.remove()
821
+ (i) => i,
822
+ (i) => i.remove()
823
823
  ).attr(
824
824
  "width",
825
- (r) => Math.max(0, r.ySize - n - i * 2)
826
- ).attr("height", (r) => r.xSize);
827
- this.transition(rt).style("opacity", 1);
825
+ (i) => Math.max(0, i.ySize - n - r * 2)
826
+ ).attr("height", (i) => i.xSize);
827
+ this.transition(it).style("opacity", 1);
828
828
  const ot = this.g.selectAll(
829
829
  C("path")
830
- ).data(h, (r) => r.target.data.state.key).join(
831
- (r) => {
830
+ ).data(h, (i) => i.target.data.state.key).join(
831
+ (i) => {
832
832
  const d = [
833
- v + m.ySize - n,
834
- k + m.xSize / 2
833
+ v + f.ySize - n,
834
+ k + f.xSize / 2
835
835
  ];
836
- return r.insert("path", "g").attr("class", "markmap-link").attr("data-depth", (S) => S.target.data.state.depth).attr("data-path", (S) => S.target.data.state.path).attr("d", u({ source: d, target: d }));
836
+ return i.insert("path", "g").attr("class", "markmap-link").attr("data-depth", (S) => S.target.data.state.depth).attr("data-path", (S) => S.target.data.state.path).attr("d", u({ source: d, target: d }));
837
837
  },
838
- (r) => r,
839
- (r) => {
838
+ (i) => i,
839
+ (i) => {
840
840
  const d = [
841
- m.y + m.ySize - n,
842
- m.x + m.xSize / 2
841
+ f.y + f.ySize - n,
842
+ f.x + f.xSize / 2
843
843
  ];
844
- return this.transition(r).attr("d", u({ source: d, target: d })).remove();
844
+ return this.transition(i).attr("d", u({ source: d, target: d })).remove();
845
845
  }
846
846
  );
847
- this.transition(ot).attr("stroke", (r) => c(r.target.data)).attr("stroke-width", (r) => W(r.target)).attr("d", (r) => {
848
- const d = r.source, S = r.target, R = [
847
+ this.transition(ot).attr("stroke", (i) => c(i.target.data)).attr("stroke-width", (i) => W(i.target)).attr("d", (i) => {
848
+ const d = i.source, S = i.target, R = [
849
849
  d.y + d.ySize - n,
850
850
  d.x + d.xSize / 2
851
851
  ], X = [
@@ -853,8 +853,8 @@ class et {
853
853
  S.x + S.xSize / 2
854
854
  ];
855
855
  return u({ source: R, target: X });
856
- }), p.forEach((r) => {
857
- r.data.state.x0 = r.x, r.data.state.y0 = r.y;
856
+ }), p.forEach((i) => {
857
+ i.data.state.x0 = i.x, i.data.state.y0 = i.y;
858
858
  });
859
859
  }
860
860
  transition(t) {
@@ -865,13 +865,13 @@ class et {
865
865
  * Fit the content to the viewport.
866
866
  */
867
867
  async fit() {
868
- const t = this.svg.node(), { width: n, height: i } = t.getBoundingClientRect(), { fitRatio: o } = this.options, { minX: a, maxX: c, minY: s, maxY: l } = this.state, p = l - s, h = c - a, u = Math.min(
868
+ const t = this.svg.node(), { width: n, height: r } = t.getBoundingClientRect(), { fitRatio: o } = this.options, { minX: a, maxX: c, minY: s, maxY: l } = this.state, p = l - s, h = c - a, u = Math.min(
869
869
  n / p * o,
870
- i / h * o,
870
+ r / h * o,
871
871
  2
872
- ), g = ft.translate(
872
+ ), g = mt.translate(
873
873
  (n - p * u) / 2 - s * u,
874
- (i - h * u) / 2 - a * u
874
+ (r - h * u) / 2 - a * u
875
875
  ).scale(u);
876
876
  return this.transition(this.svg).call(this.zoom.transform, g).end().catch(M);
877
877
  }
@@ -891,24 +891,24 @@ class et {
891
891
  */
892
892
  async ensureView(t, n) {
893
893
  var k;
894
- const i = (k = this.findElement(t)) == null ? void 0 : k.data;
895
- if (!i)
894
+ const r = (k = this.findElement(t)) == null ? void 0 : k.data;
895
+ if (!r)
896
896
  return;
897
897
  const o = this.svg.node(), { spacingHorizontal: a } = this.options, c = o.getBoundingClientRect(), s = A(o), [l, p] = [
898
- i.y,
899
- i.y + i.ySize - a + 2
898
+ r.y,
899
+ r.y + r.ySize - a + 2
900
900
  ].map((v) => v * s.k + s.x), [h, u] = [
901
- i.x - i.xSize / 2,
902
- i.x + i.xSize / 2
901
+ r.x - r.xSize / 2,
902
+ r.x + r.xSize / 2
903
903
  ].map((v) => v * s.k + s.y), g = {
904
904
  left: 0,
905
905
  right: 0,
906
906
  top: 0,
907
907
  bottom: 0,
908
908
  ...n
909
- }, x = [g.left - l, c.width - g.right - p], f = [g.top - h, c.height - g.bottom - u], y = x[0] * x[1] > 0 ? Y(x, Math.abs) / s.k : 0, m = f[0] * f[1] > 0 ? Y(f, Math.abs) / s.k : 0;
910
- if (y || m) {
911
- const v = s.translate(y, m);
909
+ }, x = [g.left - l, c.width - g.right - p], m = [g.top - h, c.height - g.bottom - u], y = x[0] * x[1] > 0 ? Y(x, Math.abs) / s.k : 0, f = m[0] * m[1] > 0 ? Y(m, Math.abs) / s.k : 0;
910
+ if (y || f) {
911
+ const v = s.translate(y, f);
912
912
  return this.transition(this.svg).call(this.zoom.transform, v).end().catch(M);
913
913
  }
914
914
  }
@@ -916,7 +916,7 @@ class et {
916
916
  * Scale content with it pinned at the center of the viewport.
917
917
  */
918
918
  async rescale(t) {
919
- const n = this.svg.node(), { width: i, height: o } = n.getBoundingClientRect(), a = i / 2, c = o / 2, s = A(n), l = s.translate(
919
+ const n = this.svg.node(), { width: r, height: o } = n.getBoundingClientRect(), a = r / 2, c = o / 2, s = A(n), l = s.translate(
920
920
  (a - s.x) * (1 - t) / s.k,
921
921
  (c - s.y) * (1 - t) / s.k
922
922
  ).scale(t);
@@ -927,9 +927,9 @@ class et {
927
927
  t();
928
928
  });
929
929
  }
930
- static create(t, n, i = null) {
930
+ static create(t, n, r = null) {
931
931
  const o = new et(t, n);
932
- return i && (o.setData(i), o.fit()), o;
932
+ return r && (o.setData(r), o.fit()), o;
933
933
  }
934
934
  }
935
935
  export {
package/dist/view.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type * as d3 from 'd3';
2
2
  import { FlextreeNode } from 'd3-flextree';
3
3
  import { Hook, IMarkmapOptions, INode, IPureNode } from 'markmap-common';
4
- import { IMarkmapState, IPadding, ID3SVGElement } from './types';
4
+ import { ID3SVGElement, IMarkmapState, IPadding } from './types';
5
5
  export declare const globalCSS: string;
6
6
  /**
7
7
  * A global hook to refresh all markmaps when called.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markmap-view",
3
- "version": "0.16.0",
3
+ "version": "0.16.3-web.2+0f4c3f8",
4
4
  "description": "View markmaps in browser",
5
5
  "author": "Gerald <gera2ld@live.com>",
6
6
  "license": "MIT",
@@ -45,10 +45,10 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/d3-flextree": "^2.1.1",
48
- "markmap-common": "0.16.0"
48
+ "markmap-common": "0.16.3-web.2+0f4c3f8"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "markmap-common": "*"
52
52
  },
53
- "gitHead": "caf3f840ad39c240ba522bfea83c57de62c6cac4"
53
+ "gitHead": "0f4c3f84ff21f0957ec3dbf338ed7a453f050638"
54
54
  }