markmap-view 0.18.4 → 0.18.5-alpha.6

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.
@@ -47,18 +47,6 @@
47
47
  });
48
48
  return classList.join(" ");
49
49
  }
50
- function childSelector(filter) {
51
- if (typeof filter === "string") {
52
- const tagName = filter;
53
- filter = (el) => el.tagName === tagName;
54
- }
55
- const filterFn = filter;
56
- return function selector() {
57
- let nodes = Array.from(this.childNodes);
58
- if (filterFn) nodes = nodes.filter((node) => filterFn(node));
59
- return nodes;
60
- };
61
- }
62
50
  function defer() {
63
51
  const obj = {};
64
52
  obj.promise = new Promise((resolve, reject) => {
@@ -413,6 +401,18 @@
413
401
  }
414
402
  return (hash >>> 0).toString(36);
415
403
  }
404
+ function childSelector(filter) {
405
+ if (typeof filter === "string") {
406
+ const tagName = filter;
407
+ filter = (el) => el.tagName === tagName;
408
+ }
409
+ const filterFn = filter;
410
+ return function selector() {
411
+ let nodes = Array.from(this.childNodes);
412
+ if (filterFn) nodes = nodes.filter((node) => filterFn(node));
413
+ return nodes;
414
+ };
415
+ }
416
416
  function count(node) {
417
417
  var sum = 0, children = node.children, i = children && children.length;
418
418
  if (!i) sum = 1;
@@ -1436,6 +1436,7 @@
1436
1436
  }
1437
1437
  }
1438
1438
  exports.Markmap = Markmap;
1439
+ exports.childSelector = childSelector;
1439
1440
  exports.defaultColorFn = defaultColorFn;
1440
1441
  exports.defaultOptions = defaultOptions;
1441
1442
  exports.deriveOptions = deriveOptions;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Hook as at, getId as lt, debounce as ct, addClass as ht, walkTree as C, childSelector as v, noop as w } from "markmap-common";
1
+ import { Hook as at, getId as lt, debounce as ct, addClass as ht, walkTree as C, noop as w } from "markmap-common";
2
2
  import { loadCSS as xe, loadJS as ye } from "markmap-common";
3
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
4
  const V = typeof navigator < "u" && navigator.userAgent.includes("Macintosh"), xt = G(dt), U = {
@@ -23,23 +23,23 @@ const V = typeof navigator < "u" && navigator.userAgent.includes("Macintosh"), x
23
23
  toggleRecursively: !1
24
24
  };
25
25
  function ue(e) {
26
- const t = {}, s = { ...e }, { color: n, colorFreezeLevel: o } = s;
27
- if ((n == null ? void 0 : n.length) === 1) {
28
- const r = n[0];
29
- t.color = () => r;
30
- } else if (n != null && n.length) {
31
- const r = G(n);
32
- t.color = (c) => r(`${c.state.path}`);
26
+ const t = {}, n = { ...e }, { color: r, colorFreezeLevel: o } = n;
27
+ if ((r == null ? void 0 : r.length) === 1) {
28
+ const s = r[0];
29
+ t.color = () => s;
30
+ } else if (r != null && r.length) {
31
+ const s = G(r);
32
+ t.color = (c) => s(`${c.state.path}`);
33
33
  }
34
34
  if (o) {
35
- const r = t.color || U.color;
35
+ const s = t.color || U.color;
36
36
  t.color = (c) => (c = {
37
37
  ...c,
38
38
  state: {
39
39
  ...c.state,
40
40
  path: c.state.path.split(".").slice(0, o).join(".")
41
41
  }
42
- }, r(c));
42
+ }, s(c));
43
43
  }
44
44
  return [
45
45
  "duration",
@@ -51,56 +51,67 @@ function ue(e) {
51
51
  "paddingX",
52
52
  "spacingHorizontal",
53
53
  "spacingVertical"
54
- ].forEach((r) => {
55
- const c = s[r];
56
- typeof c == "number" && (t[r] = c);
57
- }), ["zoom", "pan"].forEach((r) => {
58
- const c = s[r];
59
- c != null && (t[r] = !!c);
54
+ ].forEach((s) => {
55
+ const c = n[s];
56
+ typeof c == "number" && (t[s] = c);
57
+ }), ["zoom", "pan"].forEach((s) => {
58
+ const c = n[s];
59
+ c != null && (t[s] = !!c);
60
60
  }), t;
61
61
  }
62
62
  function yt(e) {
63
63
  let t = 0;
64
- for (let s = 0; s < e.length; s++)
65
- t = (t << 5) - t + e.charCodeAt(s) | 0;
64
+ for (let n = 0; n < e.length; n++)
65
+ t = (t << 5) - t + e.charCodeAt(n) | 0;
66
66
  return (t >>> 0).toString(36);
67
67
  }
68
+ function v(e) {
69
+ if (typeof e == "string") {
70
+ const n = e;
71
+ e = (r) => r.tagName === n;
72
+ }
73
+ const t = e;
74
+ return function() {
75
+ let r = Array.from(this.childNodes);
76
+ return t && (r = r.filter((o) => t(o))), r;
77
+ };
78
+ }
68
79
  function kt(e) {
69
- var t = 0, s = e.children, n = s && s.length;
70
- if (!n) t = 1;
71
- else for (; --n >= 0; ) t += s[n].value;
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;
72
83
  e.value = t;
73
84
  }
74
85
  function vt() {
75
86
  return this.eachAfter(kt);
76
87
  }
77
88
  function bt(e) {
78
- var t = this, s, n = [t], o, a, l;
89
+ var t = this, n, r = [t], o, a, l;
79
90
  do
80
- for (s = n.reverse(), n = []; t = s.pop(); )
91
+ for (n = r.reverse(), r = []; t = n.pop(); )
81
92
  if (e(t), o = t.children, o) for (a = 0, l = o.length; a < l; ++a)
82
- n.push(o[a]);
83
- while (n.length);
93
+ r.push(o[a]);
94
+ while (r.length);
84
95
  return this;
85
96
  }
86
97
  function zt(e) {
87
- for (var t = this, s = [t], n, o; t = s.pop(); )
88
- if (e(t), n = t.children, n) for (o = n.length - 1; o >= 0; --o)
89
- s.push(n[o]);
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]);
90
101
  return this;
91
102
  }
92
103
  function Et(e) {
93
- for (var t = this, s = [t], n = [], o, a, l; t = s.pop(); )
94
- if (n.push(t), o = t.children, o) for (a = 0, l = o.length; a < l; ++a)
95
- s.push(o[a]);
96
- for (; t = n.pop(); )
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(); )
97
108
  e(t);
98
109
  return this;
99
110
  }
100
111
  function Ct(e) {
101
112
  return this.eachAfter(function(t) {
102
- for (var s = +e(t.data) || 0, n = t.children, o = n && n.length; --o >= 0; ) s += n[o].value;
103
- t.value = s;
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;
104
115
  });
105
116
  }
106
117
  function wt(e) {
@@ -109,17 +120,17 @@ function wt(e) {
109
120
  });
110
121
  }
111
122
  function St(e) {
112
- for (var t = this, s = Rt(t, e), n = [t]; t !== s; )
113
- t = t.parent, n.push(t);
114
- for (var o = n.length; e !== s; )
115
- n.splice(o, 0, e), e = e.parent;
116
- return n;
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;
117
128
  }
118
129
  function Rt(e, t) {
119
130
  if (e === t) return e;
120
- var s = e.ancestors(), n = t.ancestors(), o = null;
121
- for (e = s.pop(), t = n.pop(); e === t; )
122
- o = e, e = s.pop(), t = n.pop();
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();
123
134
  return o;
124
135
  }
125
136
  function Xt() {
@@ -141,28 +152,28 @@ function jt() {
141
152
  }
142
153
  function Ot() {
143
154
  var e = this, t = [];
144
- return e.each(function(s) {
145
- s !== e && t.push({ source: s.parent, target: s });
155
+ return e.each(function(n) {
156
+ n !== e && t.push({ source: n.parent, target: n });
146
157
  }), t;
147
158
  }
148
- function B(e, t) {
149
- var s = new R(e), n = +e.value && (s.value = e.value), o, a = [s], l, r, c, p;
150
- for (t == null && (t = At); o = a.pop(); )
151
- if (n && (o.value = +o.data.value), (r = t(o.data)) && (p = r.length))
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;
161
+ for (t == null && (t = Bt); o = a.pop(); )
162
+ if (r && (o.value = +o.data.value), (s = t(o.data)) && (p = s.length))
152
163
  for (o.children = new Array(p), c = p - 1; c >= 0; --c)
153
- a.push(l = o.children[c] = new R(r[c])), l.parent = o, l.depth = o.depth + 1;
154
- return s.eachBefore(Ft);
164
+ a.push(l = o.children[c] = new R(s[c])), l.parent = o, l.depth = o.depth + 1;
165
+ return n.eachBefore($t);
155
166
  }
156
- function Bt() {
157
- return B(this).eachBefore($t);
167
+ function At() {
168
+ return A(this).eachBefore(Ft);
158
169
  }
159
- function At(e) {
170
+ function Bt(e) {
160
171
  return e.children;
161
172
  }
162
- function $t(e) {
173
+ function Ft(e) {
163
174
  e.data = e.data.data;
164
175
  }
165
- function Ft(e) {
176
+ function $t(e) {
166
177
  var t = 0;
167
178
  do
168
179
  e.height = t;
@@ -171,7 +182,7 @@ function Ft(e) {
171
182
  function R(e) {
172
183
  this.data = e, this.depth = this.height = 0, this.parent = null;
173
184
  }
174
- R.prototype = B.prototype = {
185
+ R.prototype = A.prototype = {
175
186
  constructor: R,
176
187
  count: vt,
177
188
  each: bt,
@@ -184,15 +195,15 @@ R.prototype = B.prototype = {
184
195
  descendants: Mt,
185
196
  leaves: jt,
186
197
  links: Ot,
187
- copy: Bt
198
+ copy: At
188
199
  };
189
- const Tt = "d3-flextree", Dt = "2.1.2", _t = "build/d3-flextree.js", Ht = "index", Nt = { 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 = {
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 = {
190
201
  name: Tt,
191
202
  version: Dt,
192
- main: _t,
193
- module: Ht,
203
+ main: Nt,
204
+ module: _t,
194
205
  "jsnext:main": "index",
195
- author: Nt,
206
+ author: Ht,
196
207
  description: Lt,
197
208
  keywords: Pt,
198
209
  homepage: Wt,
@@ -208,17 +219,17 @@ const Tt = "d3-flextree", Dt = "2.1.2", _t = "build/d3-flextree.js", Ht = "index
208
219
  });
209
220
  function Z(e) {
210
221
  const t = Object.assign({}, qt, e);
211
- function s(r) {
212
- const c = t[r];
222
+ function n(s) {
223
+ const c = t[s];
213
224
  return typeof c == "function" ? c : () => c;
214
225
  }
215
- function n(r) {
216
- const c = l(a(), r, (p) => p.children);
226
+ function r(s) {
227
+ const c = l(a(), s, (p) => p.children);
217
228
  return c.update(), c.data;
218
229
  }
219
230
  function o() {
220
- const r = s("nodeSize"), c = s("spacing");
221
- return class Y extends B.prototype.constructor {
231
+ const s = n("nodeSize"), c = n("spacing");
232
+ return class Y extends A.prototype.constructor {
222
233
  constructor(h) {
223
234
  super(h);
224
235
  }
@@ -227,7 +238,7 @@ function Z(e) {
227
238
  return h.each((u) => u.data = u.data.data), h;
228
239
  }
229
240
  get size() {
230
- return r(this);
241
+ return s(this);
231
242
  }
232
243
  spacing(h) {
233
244
  return c(this, h);
@@ -297,8 +308,8 @@ function Z(e) {
297
308
  };
298
309
  }
299
310
  function a() {
300
- const r = o(), c = s("nodeSize"), p = s("spacing");
301
- return class extends r {
311
+ const s = o(), c = n("nodeSize"), p = n("spacing");
312
+ return class extends s {
302
313
  constructor(h) {
303
314
  super(h), Object.assign(this, {
304
315
  x: 0,
@@ -338,9 +349,9 @@ function Z(e) {
338
349
  }
339
350
  };
340
351
  }
341
- function l(r, c, p) {
352
+ function l(s, c, p) {
342
353
  const h = (u, m) => {
343
- const g = new r(u);
354
+ const g = new s(u);
344
355
  Object.assign(g, {
345
356
  parent: m,
346
357
  depth: m === null ? 0 : m.depth + 1,
@@ -358,123 +369,123 @@ function Z(e) {
358
369
  };
359
370
  return h(c, null);
360
371
  }
361
- return Object.assign(n, {
362
- nodeSize(r) {
363
- return arguments.length ? (t.nodeSize = r, n) : t.nodeSize;
372
+ return Object.assign(r, {
373
+ nodeSize(s) {
374
+ return arguments.length ? (t.nodeSize = s, r) : t.nodeSize;
364
375
  },
365
- spacing(r) {
366
- return arguments.length ? (t.spacing = r, n) : t.spacing;
376
+ spacing(s) {
377
+ return arguments.length ? (t.spacing = s, r) : t.spacing;
367
378
  },
368
- children(r) {
369
- return arguments.length ? (t.children = r, n) : t.children;
379
+ children(s) {
380
+ return arguments.length ? (t.children = s, r) : t.children;
370
381
  },
371
- hierarchy(r, c) {
382
+ hierarchy(s, c) {
372
383
  const p = typeof c > "u" ? t.children : c;
373
- return l(o(), r, p);
384
+ return l(o(), s, p);
374
385
  },
375
- dump(r) {
376
- const c = s("nodeSize"), p = (h) => (u) => {
386
+ dump(s) {
387
+ const c = n("nodeSize"), p = (h) => (u) => {
377
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}`;
378
389
  return `{ size: [${b.join(", ")}],${m}x: ${y}, y: ${x}${z}},`;
379
390
  };
380
391
  return p(`
381
- `)(r);
392
+ `)(s);
382
393
  }
383
- }), n;
394
+ }), r;
384
395
  }
385
396
  Z.version = Zt;
386
- const q = (e, t = 0) => (e.y = t, (e.children || []).reduce((s, n) => {
387
- const [o, a] = s;
388
- q(n, e.y + e.ySize);
389
- const l = (o === 0 ? n.lExt : n.rExt).bottom;
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;
390
401
  o !== 0 && Qt(e, o, a);
391
- const r = ae(l, o, a);
392
- return [o + 1, r];
393
- }, [0, null]), Jt(e), oe(e), e), J = (e, t, s) => {
394
- typeof t > "u" && (t = -e.relX - e.prelim, s = 0);
395
- const n = t + e.relX;
396
- return e.relX = n + e.prelim - s, e.prelim = 0, e.x = s + e.relX, (e.children || []).forEach((o) => J(o, n, e.x)), e;
402
+ const s = ae(l, o, a);
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;
397
408
  }, Jt = (e) => {
398
- (e.children || []).reduce((t, s) => {
399
- const [n, o] = t, a = n + s.shift, l = o + a + s.change;
400
- return s.relX += l, [a, l];
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];
401
412
  }, [0, 0]);
402
- }, Qt = (e, t, s) => {
403
- const n = e.children[t - 1], o = e.children[t];
404
- let a = n, l = n.relX, r = o, c = o.relX, p = !0;
405
- for (; a && r; ) {
406
- a.bottom > s.lowY && (s = s.next);
407
- const h = l + a.prelim - (c + r.prelim) + a.xSize / 2 + r.xSize / 2 + a.spacing(r);
408
- (h > 0 || h < 0 && p) && (c += h, te(o, h), ee(e, t, s.index, h)), p = !1;
409
- const u = a.bottom, m = r.bottom;
410
- u <= m && (a = ne(a), a && (l += a.relX)), u >= m && (r = re(r), r && (c += r.relX));
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;
416
+ for (; a && s; ) {
417
+ a.bottom > n.lowY && (n = n.next);
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));
411
422
  }
412
- !a && r ? se(e, t, r, c) : a && !r && ie(e, t, a, l);
423
+ !a && s ? se(e, t, s, c) : a && !s && ie(e, t, a, l);
413
424
  }, te = (e, t) => {
414
425
  e.relX += t, e.lExtRelX += t, e.rExtRelX += t;
415
- }, ee = (e, t, s, n) => {
416
- const o = e.children[t], a = t - s;
426
+ }, ee = (e, t, n, r) => {
427
+ const o = e.children[t], a = t - n;
417
428
  if (a > 1) {
418
- const l = n / a;
419
- e.children[s + 1].shift += l, o.shift -= l, o.change -= n - l;
429
+ const l = r / a;
430
+ e.children[n + 1].shift += l, o.shift -= l, o.change -= r - l;
420
431
  }
421
- }, re = (e) => e.hasChildren ? e.firstChild : e.lThr, ne = (e) => e.hasChildren ? e.lastChild : e.rThr, se = (e, t, s, n) => {
432
+ }, re = (e) => e.hasChildren ? e.firstChild : e.lThr, ne = (e) => e.hasChildren ? e.lastChild : e.rThr, se = (e, t, n, r) => {
422
433
  const o = e.firstChild, a = o.lExt, l = e.children[t];
423
- a.lThr = s;
424
- const r = n - s.relX - o.lExtRelX;
425
- a.relX += r, a.prelim -= r, o.lExt = l.lExt, o.lExtRelX = l.lExtRelX;
426
- }, ie = (e, t, s, n) => {
434
+ a.lThr = n;
435
+ const s = r - n.relX - o.lExtRelX;
436
+ a.relX += s, a.prelim -= s, o.lExt = l.lExt, o.lExtRelX = l.lExtRelX;
437
+ }, ie = (e, t, n, r) => {
427
438
  const o = e.children[t], a = o.rExt, l = e.children[t - 1];
428
- a.rThr = s;
429
- const r = n - s.relX - o.rExtRelX;
430
- a.relX += r, a.prelim -= r, o.rExt = l.rExt, o.rExtRelX = l.rExtRelX;
439
+ a.rThr = n;
440
+ const s = r - n.relX - o.rExtRelX;
441
+ a.relX += s, a.prelim -= s, o.rExt = l.rExt, o.rExtRelX = l.rExtRelX;
431
442
  }, oe = (e) => {
432
443
  if (e.hasChildren) {
433
- const t = e.firstChild, s = e.lastChild, n = (t.prelim + t.relX - t.xSize / 2 + s.relX + s.prelim + s.xSize / 2) / 2;
444
+ const t = e.firstChild, n = e.lastChild, r = (t.prelim + t.relX - t.xSize / 2 + n.relX + n.prelim + n.xSize / 2) / 2;
434
445
  Object.assign(e, {
435
- prelim: n,
446
+ prelim: r,
436
447
  lExt: t.lExt,
437
448
  lExtRelX: t.lExtRelX,
438
- rExt: s.rExt,
439
- rExtRelX: s.rExtRelX
449
+ rExt: n.rExt,
450
+ rExtRelX: n.rExtRelX
440
451
  });
441
452
  }
442
- }, ae = (e, t, s) => {
443
- for (; s !== null && e >= s.lowY; )
444
- s = s.next;
453
+ }, ae = (e, t, n) => {
454
+ for (; n !== null && e >= n.lowY; )
455
+ n = n.next;
445
456
  return {
446
457
  lowY: e,
447
458
  index: t,
448
- next: s
459
+ next: n
449
460
  };
450
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();
451
462
  function I(e) {
452
463
  return Math.max(4 - 2 * e.state.depth, 1.5);
453
464
  }
454
465
  function K(e, t) {
455
- const s = ft(e, t);
456
- return e[s];
466
+ const n = ft(e, t);
467
+ return e[n];
457
468
  }
458
469
  function O(e) {
459
470
  e.stopPropagation();
460
471
  }
461
472
  const le = new at();
462
473
  class tt {
463
- constructor(t, s) {
464
- this.options = U, this.revokers = [], this.handleZoom = (n) => {
465
- const { transform: o } = n;
474
+ constructor(t, n) {
475
+ this.options = U, this.revokers = [], this.handleZoom = (r) => {
476
+ const { transform: o } = r;
466
477
  this.g.attr("transform", o);
467
- }, this.handlePan = (n) => {
468
- n.preventDefault();
478
+ }, this.handlePan = (r) => {
479
+ r.preventDefault();
469
480
  const o = S(this.svg.node()), a = o.translate(
470
- -n.deltaX / o.k,
471
- -n.deltaY / o.k
481
+ -r.deltaX / o.k,
482
+ -r.deltaY / o.k
472
483
  );
473
484
  this.svg.call(this.zoom.transform, a);
474
- }, this.handleClick = (n, o) => {
485
+ }, this.handleClick = (r, o) => {
475
486
  let a = this.options.toggleRecursively;
476
- (V ? n.metaKey : n.ctrlKey) && (a = !a), this.toggleNode(o, a);
477
- }, this.ensureView = this.ensureVisible, this.svg = t.datum ? t : ut(t), this.styleNode = this.svg.append("style"), this.zoom = mt().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(s), this.state = {
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 = {
478
489
  id: this.options.id || this.svg.attr("id") || lt(),
479
490
  rect: { x1: 0, y1: 0, x2: 0, y2: 0 }
480
491
  }, this.g = this.svg.append("g"), this.observer = new ResizeObserver(
@@ -489,8 +500,8 @@ class tt {
489
500
  );
490
501
  }
491
502
  getStyleContent() {
492
- const { style: t } = this.options, { id: s } = this.state, n = typeof t == "function" ? t(s) : "";
493
- return [this.options.embedGlobalCSS && Q, n].filter(Boolean).join(`
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(`
494
505
  `);
495
506
  }
496
507
  updateStyle() {
@@ -501,29 +512,29 @@ class tt {
501
512
  const t = this.getStyleContent();
502
513
  this.styleNode.text(t);
503
514
  }
504
- async toggleNode(t, s = !1) {
515
+ async toggleNode(t, n = !1) {
505
516
  var o, a;
506
- const n = (o = t.payload) != null && o.fold ? 0 : 1;
507
- s ? C(t, (l, r) => {
517
+ const r = (o = t.payload) != null && o.fold ? 0 : 1;
518
+ n ? C(t, (l, s) => {
508
519
  l.payload = {
509
520
  ...l.payload,
510
- fold: n
511
- }, r();
521
+ fold: r
522
+ }, s();
512
523
  }) : t.payload = {
513
524
  ...t.payload,
514
525
  fold: (a = t.payload) != null && a.fold ? 0 : 1
515
526
  }, await this.renderData(t);
516
527
  }
517
528
  _initializeData(t) {
518
- let s = 0;
519
- const { color: n, initialExpandLevel: o } = this.options;
529
+ let n = 0;
530
+ const { color: r, initialExpandLevel: o } = this.options;
520
531
  let a = 0, l = 0;
521
- C(t, (r, c, p) => {
532
+ C(t, (s, c, p) => {
522
533
  var u, m, g, y;
523
- l += 1, r.children = (u = r.children) == null ? void 0 : u.map((x) => ({ ...x })), s += 1, r.state = {
524
- ...r.state,
534
+ l += 1, s.children = (u = s.children) == null ? void 0 : u.map((x) => ({ ...x })), n += 1, s.state = {
535
+ ...s.state,
525
536
  depth: l,
526
- id: s,
537
+ id: n,
527
538
  rect: {
528
539
  x: 0,
529
540
  y: 0,
@@ -531,47 +542,47 @@ class tt {
531
542
  height: 0
532
543
  },
533
544
  size: [0, 0]
534
- }, r.state.key = [(m = p == null ? void 0 : p.state) == null ? void 0 : m.id, r.state.id].filter(Boolean).join(".") + yt(r.content), r.state.path = [(g = p == null ? void 0 : p.state) == null ? void 0 : g.path, r.state.id].filter(Boolean).join("."), n(r);
535
- const h = ((y = r.payload) == null ? void 0 : y.fold) === 2;
536
- h ? a += 1 : (a || o >= 0 && r.state.depth >= o) && (r.payload = { ...r.payload, fold: 1 }), c(), h && (a -= 1), l -= 1;
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);
546
+ const h = ((y = s.payload) == null ? void 0 : y.fold) === 2;
547
+ h ? a += 1 : (a || o >= 0 && s.state.depth >= o) && (s.payload = { ...s.payload, fold: 1 }), c(), h && (a -= 1), l -= 1;
537
548
  });
538
549
  }
539
550
  _relayout() {
540
551
  if (!this.state.data) return;
541
552
  this.g.selectAll(v("g")).selectAll(
542
553
  v("foreignObject")
543
- ).each(function(r) {
554
+ ).each(function(s) {
544
555
  var h;
545
556
  const c = (h = this.firstChild) == null ? void 0 : h.firstChild, p = [c.scrollWidth, c.scrollHeight];
546
- r.state.size = p;
557
+ s.state.size = p;
547
558
  });
548
- const { spacingHorizontal: t, paddingX: s, spacingVertical: n } = this.options, o = Z({}).children((r) => {
559
+ const { spacingHorizontal: t, paddingX: n, spacingVertical: r } = this.options, o = Z({}).children((s) => {
549
560
  var c;
550
- if (!((c = r.payload) != null && c.fold)) return r.children;
551
- }).nodeSize((r) => {
552
- const [c, p] = r.data.state.size;
553
- return [p, c + (c ? s * 2 : 0) + t];
554
- }).spacing((r, c) => r.parent === c.parent ? n : n * 2), a = o.hierarchy(this.state.data);
561
+ if (!((c = s.payload) != null && c.fold)) return s.children;
562
+ }).nodeSize((s) => {
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);
555
566
  o(a);
556
567
  const l = a.descendants();
557
- l.forEach((r) => {
558
- const c = r.data;
568
+ l.forEach((s) => {
569
+ const c = s.data;
559
570
  c.state.rect = {
560
- x: r.y,
561
- y: r.x - r.xSize / 2,
562
- width: r.ySize - t,
563
- height: r.xSize
571
+ x: s.y,
572
+ y: s.x - s.xSize / 2,
573
+ width: s.ySize - t,
574
+ height: s.xSize
564
575
  };
565
576
  }), this.state.rect = {
566
- x1: P(l, (r) => r.data.state.rect.x) || 0,
567
- y1: P(l, (r) => r.data.state.rect.y) || 0,
577
+ x1: P(l, (s) => s.data.state.rect.x) || 0,
578
+ y1: P(l, (s) => s.data.state.rect.y) || 0,
568
579
  x2: W(
569
580
  l,
570
- (r) => r.data.state.rect.x + r.data.state.rect.width
581
+ (s) => s.data.state.rect.x + s.data.state.rect.width
571
582
  ) || 0,
572
583
  y2: W(
573
584
  l,
574
- (r) => r.data.state.rect.y + r.data.state.rect.height
585
+ (s) => s.data.state.rect.y + s.data.state.rect.height
575
586
  ) || 0
576
587
  };
577
588
  }
@@ -581,39 +592,39 @@ class tt {
581
592
  ...t
582
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);
583
594
  }
584
- async setData(t, s) {
585
- s && this.setOptions(s), t && (this.state.data = t), this.state.data && (this._initializeData(this.state.data), this.updateStyle(), await this.renderData());
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());
586
597
  }
587
598
  async renderData(t) {
588
- const { paddingX: s, autoFit: n, color: o, maxWidth: a } = this.options, l = this.state.data;
599
+ const { paddingX: n, autoFit: r, color: o, maxWidth: a } = this.options, l = this.state.data;
589
600
  if (!l) return;
590
- const r = {}, c = {}, p = [];
601
+ const s = {}, c = {}, p = [];
591
602
  C(l, (i, d, f) => {
592
603
  var E;
593
- (E = i.payload) != null && E.fold || d(), r[i.state.id] = i, f && (c[i.state.id] = f.state.id), p.push(i);
604
+ (E = i.payload) != null && E.fold || d(), s[i.state.id] = i, f && (c[i.state.id] = f.state.id), p.push(i);
594
605
  });
595
606
  const h = {}, u = {}, m = (i) => {
596
607
  !i || h[i.state.id] || C(i, (d, f) => {
597
608
  h[d.state.id] = i.state.id, f();
598
609
  });
599
- }, g = (i) => u[h[i.state.id]] || l.state.rect, y = (i) => (r[h[i.state.id]] || l).state.rect;
610
+ }, g = (i) => u[h[i.state.id]] || l.state.rect, y = (i) => (s[h[i.state.id]] || l).state.rect;
600
611
  u[l.state.id] = l.state.rect, t && m(t);
601
612
  const x = this.g.selectAll(v("g")).each((i) => {
602
613
  u[i.state.id] = i.state.rect;
603
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) => {
604
- m(r[c[i.state.id]]);
615
+ m(s[c[i.state.id]]);
605
616
  }), k = x.exit().each((i) => {
606
- m(r[c[i.state.id]]);
617
+ m(s[c[i.state.id]]);
607
618
  }), z = x.merge(b).attr(
608
619
  "class",
609
620
  (i) => {
610
621
  var d;
611
622
  return ["markmap-node", ((d = i.payload) == null ? void 0 : d.fold) && "markmap-fold"].filter(Boolean).join(" ");
612
623
  }
613
- ), A = z.selectAll(v("line")).data(
624
+ ), B = z.selectAll(v("line")).data(
614
625
  (i) => [i],
615
626
  (i) => i.state.key
616
- ), $ = A.enter().append("line").attr("stroke", (i) => o(i)).attr("stroke-width", 0), F = A.merge($), T = z.selectAll(v("circle")).data(
627
+ ), F = B.enter().append("line").attr("stroke", (i) => o(i)).attr("stroke-width", 0), $ = B.merge(F), T = z.selectAll(v("circle")).data(
617
628
  (i) => {
618
629
  var d;
619
630
  return (d = i.children) != null && d.length ? [i] : [];
@@ -625,24 +636,24 @@ class tt {
625
636
  var d;
626
637
  return (d = i.payload) != null && d.fold && i.children ? o(i) : "var(--markmap-circle-open-bg)";
627
638
  }
628
- ), _ = this.observer, H = z.selectAll(v("foreignObject")).data(
639
+ ), N = this.observer, _ = z.selectAll(v("foreignObject")).data(
629
640
  (i) => [i],
630
641
  (i) => i.state.key
631
- ), X = H.enter().append("foreignObject").attr("class", "markmap-foreign").attr("x", s).attr("y", 0).style("opacity", 0).on("mousedown", O).on("dblclick", O);
642
+ ), X = _.enter().append("foreignObject").attr("class", "markmap-foreign").attr("x", n).attr("y", 0).style("opacity", 0).on("mousedown", O).on("dblclick", O);
632
643
  X.append("xhtml:div").append("xhtml:div").html((i) => i.content).attr("xmlns", "http://www.w3.org/1999/xhtml"), X.each(function() {
633
644
  var d;
634
645
  const i = (d = this.firstChild) == null ? void 0 : d.firstChild;
635
- _.observe(i);
646
+ N.observe(i);
636
647
  });
637
- const N = k.selectAll(
648
+ const H = k.selectAll(
638
649
  v("foreignObject")
639
650
  );
640
- N.each(function() {
651
+ H.each(function() {
641
652
  var d;
642
653
  const i = (d = this.firstChild) == null ? void 0 : d.firstChild;
643
- _.unobserve(i);
654
+ N.unobserve(i);
644
655
  });
645
- const L = X.merge(H), et = p.flatMap(
656
+ const L = X.merge(_), et = p.flatMap(
646
657
  (i) => {
647
658
  var d;
648
659
  return (d = i.payload) != null && d.fold ? [] : i.children.map((f) => ({ source: i, target: f }));
@@ -670,11 +681,11 @@ class tt {
670
681
  const st = k.selectAll(
671
682
  v("line")
672
683
  );
673
- this.transition(st).attr("x1", (i) => i.state.rect.width).attr("stroke-width", 0), $.attr("x1", (i) => i.state.rect.width).attr("x2", (i) => i.state.rect.width), F.attr("y1", (i) => i.state.rect.height).attr("y2", (i) => i.state.rect.height), this.transition(F).attr("x1", -1).attr("x2", (i) => i.state.rect.width + 2).attr("stroke", (i) => o(i)).attr("stroke-width", I);
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);
674
685
  const it = k.selectAll(
675
686
  v("circle")
676
687
  );
677
- 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(N).style("opacity", 0), L.attr("width", (i) => Math.max(0, i.state.rect.width - s * 2)).attr("height", (i) => i.state.rect.height), this.transition(L).style("opacity", 1), this.transition(rt).attr("d", (i) => {
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) => {
678
689
  const d = y(i.target), f = [
679
690
  d.x + d.width,
680
691
  d.y + d.height
@@ -689,71 +700,71 @@ class tt {
689
700
  f.state.rect.y + f.state.rect.height
690
701
  ];
691
702
  return j({ source: E, target: ot });
692
- }), n && this.fit();
703
+ }), r && this.fit();
693
704
  }
694
705
  transition(t) {
695
- const { duration: s } = this.options;
696
- return t.transition().duration(s);
706
+ const { duration: n } = this.options;
707
+ return t.transition().duration(n);
697
708
  }
698
709
  /**
699
710
  * Fit the content to the viewport.
700
711
  */
701
712
  async fit(t = this.options.maxInitialScale) {
702
- const s = this.svg.node(), { width: n, height: o } = s.getBoundingClientRect(), { fitRatio: a } = this.options, { x1: l, y1: r, x2: c, y2: p } = this.state.rect, h = c - l, u = p - r, m = Math.min(
703
- n / h * a,
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,
704
715
  o / u * a,
705
716
  t
706
717
  ), g = gt.translate(
707
- (n - h * m) / 2 - l * m,
708
- (o - u * m) / 2 - r * m
718
+ (r - h * m) / 2 - l * m,
719
+ (o - u * m) / 2 - s * m
709
720
  ).scale(m);
710
721
  return this.transition(this.svg).call(this.zoom.transform, g).end().catch(w);
711
722
  }
712
723
  findElement(t) {
713
- let s;
724
+ let n;
714
725
  return this.g.selectAll(v("g")).each(function(o) {
715
- o === t && (s = {
726
+ o === t && (n = {
716
727
  data: o,
717
728
  g: this
718
729
  });
719
- }), s;
730
+ }), n;
720
731
  }
721
732
  /**
722
733
  * Pan the content to make the provided node visible in the viewport.
723
734
  */
724
- async ensureVisible(t, s) {
735
+ async ensureVisible(t, n) {
725
736
  var b;
726
- const n = (b = this.findElement(t)) == null ? void 0 : b.data;
727
- if (!n) return;
728
- const o = this.svg.node(), a = o.getBoundingClientRect(), l = S(o), [r, c] = [
729
- n.state.rect.x,
730
- n.state.rect.x + n.state.rect.width + 2
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
731
742
  ].map((k) => k * l.k + l.x), [p, h] = [
732
- n.state.rect.y,
733
- n.state.rect.y + n.state.rect.height
743
+ r.state.rect.y,
744
+ r.state.rect.y + r.state.rect.height
734
745
  ].map((k) => k * l.k + l.y), u = {
735
746
  left: 0,
736
747
  right: 0,
737
748
  top: 0,
738
749
  bottom: 0,
739
- ...s
740
- }, m = [u.left - r, 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;
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;
741
752
  if (y || x) {
742
753
  const k = l.translate(y, x);
743
754
  return this.transition(this.svg).call(this.zoom.transform, k).end().catch(w);
744
755
  }
745
756
  }
746
- async centerNode(t, s) {
757
+ async centerNode(t, n) {
747
758
  var y;
748
- const n = (y = this.findElement(t)) == null ? void 0 : y.data;
749
- if (!n) return;
750
- const o = this.svg.node(), a = o.getBoundingClientRect(), l = S(o), r = (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 = {
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 = {
751
762
  left: 0,
752
763
  right: 0,
753
764
  top: 0,
754
765
  bottom: 0,
755
- ...s
756
- }, h = (p.left + a.width - p.right) / 2, u = (p.top + a.height - p.bottom) / 2, m = (h - r) / l.k, g = (u - c) / l.k;
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;
757
768
  if (m || g) {
758
769
  const x = l.translate(m, g);
759
770
  return this.transition(this.svg).call(this.zoom.transform, x).end().catch(w);
@@ -763,9 +774,9 @@ class tt {
763
774
  * Scale content with it pinned at the center of the viewport.
764
775
  */
765
776
  async rescale(t) {
766
- const s = this.svg.node(), { width: n, height: o } = s.getBoundingClientRect(), a = n / 2, l = o / 2, r = S(s), c = r.translate(
767
- (a - r.x) * (1 - t) / r.k,
768
- (l - r.y) * (1 - t) / r.k
777
+ const n = this.svg.node(), { width: r, height: o } = n.getBoundingClientRect(), a = r / 2, l = o / 2, s = S(n), c = s.translate(
778
+ (a - s.x) * (1 - t) / s.k,
779
+ (l - s.y) * (1 - t) / s.k
769
780
  ).scale(t);
770
781
  return this.transition(this.svg).call(this.zoom.transform, c).end().catch(w);
771
782
  }
@@ -774,15 +785,16 @@ class tt {
774
785
  t();
775
786
  });
776
787
  }
777
- static create(t, s, n = null) {
778
- const o = new tt(t, s);
779
- return n && o.setData(n).then(() => {
788
+ static create(t, n, r = null) {
789
+ const o = new tt(t, n);
790
+ return r && o.setData(r).then(() => {
780
791
  o.fit();
781
792
  }), o;
782
793
  }
783
794
  }
784
795
  export {
785
796
  tt as Markmap,
797
+ v as childSelector,
786
798
  xt as defaultColorFn,
787
799
  U as defaultOptions,
788
800
  ue as deriveOptions,
package/dist/util.d.ts CHANGED
@@ -5,3 +5,4 @@ export declare function deriveOptions(jsonOptions?: Partial<IMarkmapJSONOptions>
5
5
  * Credit: https://gist.github.com/jlevy/c246006675becc446360a798e2b2d781?permalink_comment_id=4738050#gistcomment-4738050
6
6
  */
7
7
  export declare function simpleHash(str: string): string;
8
+ export declare function childSelector<T extends Element>(filter?: string | ((el: T) => boolean)): () => T[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markmap-view",
3
- "version": "0.18.4",
3
+ "version": "0.18.5-alpha.6+cea75c9",
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.4"
49
+ "markmap-common": "0.18.5-alpha.6+cea75c9"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "markmap-common": "*"
53
53
  },
54
- "gitHead": "eb77f9eb79a44d60237f9a9cdadf0a7ca7fa9e29"
54
+ "gitHead": "cea75c9906a30ddf515f94bd6ad61d6c9ca4035a"
55
55
  }