markmap-view 0.17.1-alpha.5 → 0.17.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.
@@ -401,10 +401,12 @@
401
401
  }
402
402
  const numberKeys = [
403
403
  "duration",
404
- "maxWidth",
405
- "initialExpandLevel",
406
404
  "fitRatio",
405
+ "initialExpandLevel",
407
406
  "maxInitialScale",
407
+ "maxWidth",
408
+ "nodeMinHeight",
409
+ "paddingX",
408
410
  "spacingHorizontal",
409
411
  "spacingVertical"
410
412
  ];
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
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";
1
+ import { Hook as st, getId as at, debounce as lt, addClass as ct, walkTree as M, childSelector as C, noop as T } from "markmap-common";
2
2
  import { loadCSS as Ce, loadJS as we } from "markmap-common";
3
- import { scaleOrdinal as Y, schemeCategory10 as ht, zoomTransform as A, select as dt, zoom as ut, linkHorizontal as pt, min as I, max as H, zoomIdentity as mt, minIndex as ft } from "d3";
3
+ import { scaleOrdinal as Y, schemeCategory10 as ht, zoomTransform as A, select as dt, zoom as ut, linkHorizontal as pt, min as H, max as I, zoomIdentity as mt, minIndex as ft } from "d3";
4
4
  const K = typeof navigator < "u" && navigator.userAgent.includes("Macintosh"), gt = Y(ht), P = {
5
5
  autoFit: !1,
6
6
  color: (e) => {
@@ -43,10 +43,12 @@ function Se(e) {
43
43
  }
44
44
  return [
45
45
  "duration",
46
- "maxWidth",
47
- "initialExpandLevel",
48
46
  "fitRatio",
47
+ "initialExpandLevel",
49
48
  "maxInitialScale",
49
+ "maxWidth",
50
+ "nodeMinHeight",
51
+ "paddingX",
50
52
  "spacingHorizontal",
51
53
  "spacingVertical"
52
54
  ].forEach((s) => {
@@ -188,14 +190,14 @@ function Rt(e) {
188
190
  while (i.length);
189
191
  return this;
190
192
  }
191
- function Tt(e) {
193
+ function Mt(e) {
192
194
  for (var t = this, n = [t], i, o; t = n.pop(); )
193
195
  if (e(t), i = t.children, i)
194
196
  for (o = i.length - 1; o >= 0; --o)
195
197
  n.push(i[o]);
196
198
  return this;
197
199
  }
198
- function Mt(e) {
200
+ function Tt(e) {
199
201
  for (var t = this, n = [t], i = [], o, a, c; t = n.pop(); )
200
202
  if (i.push(t), o = t.children, o)
201
203
  for (a = 0, c = o.length; a < c; ++a)
@@ -248,7 +250,7 @@ function Ft() {
248
250
  t.children || e.push(t);
249
251
  }), e;
250
252
  }
251
- function It() {
253
+ function Ht() {
252
254
  var e = this, t = [];
253
255
  return e.each(function(n) {
254
256
  n !== e && t.push({ source: n.parent, target: n });
@@ -262,7 +264,7 @@ function F(e, t) {
262
264
  a.push(c = o.children[l] = new N(s[l])), c.parent = o, c.depth = o.depth + 1;
263
265
  return n.eachBefore(Vt);
264
266
  }
265
- function Ht() {
267
+ function It() {
266
268
  return F(this).eachBefore(Wt);
267
269
  }
268
270
  function Lt(e) {
@@ -284,16 +286,16 @@ N.prototype = F.prototype = {
284
286
  constructor: N,
285
287
  count: Nt,
286
288
  each: Rt,
287
- eachAfter: Mt,
288
- eachBefore: Tt,
289
+ eachAfter: Tt,
290
+ eachBefore: Mt,
289
291
  sum: At,
290
292
  sort: _t,
291
293
  path: Ot,
292
294
  ancestors: $t,
293
295
  descendants: Bt,
294
296
  leaves: Ft,
295
- links: It,
296
- copy: Ht
297
+ links: Ht,
298
+ copy: It
297
299
  };
298
300
  const Yt = "d3-flextree", Kt = "2.1.2", Pt = "build/d3-flextree.js", Ut = "index", Gt = {
299
301
  name: "Chris Maloney",
@@ -660,7 +662,7 @@ class et {
660
662
  toggleNode(t, n = !1) {
661
663
  var o, a;
662
664
  const i = (o = t.payload) != null && o.fold ? 0 : 1;
663
- n ? T(t, (c, s) => {
665
+ n ? M(t, (c, s) => {
664
666
  c.payload = {
665
667
  ...c.payload,
666
668
  fold: i
@@ -681,7 +683,7 @@ class et {
681
683
  document.body.append(l, p);
682
684
  const h = a ? `--markmap-max-width: ${a}px` : "";
683
685
  let u = 0, g = 0;
684
- T(t, (m, y, f) => {
686
+ M(t, (m, y, f) => {
685
687
  var b, w, z;
686
688
  g += 1, m.children = (b = m.children) == null ? void 0 : b.map((E) => ({ ...E })), n += 1;
687
689
  const k = O(
@@ -709,7 +711,7 @@ class et {
709
711
  this._checkImages(l), x.forEach((m) => {
710
712
  var y;
711
713
  (y = m.parentNode) == null || y.append(m.cloneNode(!0));
712
- }), T(t, (m, y, f) => {
714
+ }), M(t, (m, y, f) => {
713
715
  var b;
714
716
  const k = m.state, v = k.el.getBoundingClientRect();
715
717
  m.content = k.el.innerHTML, k.size = [
@@ -755,7 +757,7 @@ class et {
755
757
  return [S, d + (d ? i * 2 : 0) + n];
756
758
  }).spacing((r, d) => r.parent === d.parent ? o : o * 2), l = s.hierarchy(this.state.data);
757
759
  s(l);
758
- const p = l.descendants().reverse(), h = l.links(), u = pt(), g = I(p, (r) => r.x - r.xSize / 2), x = H(p, (r) => r.x + r.xSize / 2), m = I(p, (r) => r.y), y = H(p, (r) => r.y + r.ySize - n);
760
+ const p = l.descendants().reverse(), h = l.links(), u = pt(), g = H(p, (r) => r.x - r.xSize / 2), x = I(p, (r) => r.x + r.xSize / 2), m = H(p, (r) => r.y), y = I(p, (r) => r.y + r.ySize - n);
759
761
  Object.assign(this.state, {
760
762
  minX: g,
761
763
  maxX: x,
@@ -882,7 +884,7 @@ class et {
882
884
  (i - h * g) / 2 - l * g,
883
885
  (o - u * g) / 2 - c * g
884
886
  ).scale(g);
885
- return this.transition(this.svg).call(this.zoom.transform, x).end().catch(M);
887
+ return this.transition(this.svg).call(this.zoom.transform, x).end().catch(T);
886
888
  }
887
889
  findElement(t) {
888
890
  let n;
@@ -918,7 +920,7 @@ class et {
918
920
  }, x = [g.left - l, c.width - g.right - p], m = [g.top - h, c.height - g.bottom - u], y = x[0] * x[1] > 0 ? V(x, Math.abs) / s.k : 0, f = m[0] * m[1] > 0 ? V(m, Math.abs) / s.k : 0;
919
921
  if (y || f) {
920
922
  const v = s.translate(y, f);
921
- return this.transition(this.svg).call(this.zoom.transform, v).end().catch(M);
923
+ return this.transition(this.svg).call(this.zoom.transform, v).end().catch(T);
922
924
  }
923
925
  }
924
926
  /**
@@ -929,7 +931,7 @@ class et {
929
931
  (a - s.x) * (1 - t) / s.k,
930
932
  (c - s.y) * (1 - t) / s.k
931
933
  ).scale(t);
932
- return this.transition(this.svg).call(this.zoom.transform, l).end().catch(M);
934
+ return this.transition(this.svg).call(this.zoom.transform, l).end().catch(T);
933
935
  }
934
936
  destroy() {
935
937
  this.svg.on(".zoom", null), this.svg.html(null), this.revokers.forEach((t) => {
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { INode } from 'markmap-common';
2
1
  import { FlextreeNode } from 'd3-flextree';
2
+ import { INode } from 'markmap-common';
3
3
  export interface IMarkmapState {
4
4
  id: string;
5
5
  data?: INode;
@@ -8,19 +8,24 @@ export interface IMarkmapState {
8
8
  minY: number;
9
9
  maxY: number;
10
10
  }
11
- export interface IMarkmapJSONOptions {
12
- color?: string[];
13
- colorFreezeLevel?: number;
14
- duration?: number;
15
- maxWidth?: number;
16
- initialExpandLevel?: number;
17
- fitRatio?: number;
18
- maxInitialScale?: number;
19
- extraJs?: string[];
20
- extraCss?: string[];
21
- zoom?: boolean;
22
- pan?: boolean;
23
- }
11
+ export type IMarkmapJSONOptions = Partial<{
12
+ color: string[];
13
+ colorFreezeLevel: number;
14
+ duration: number;
15
+ extraCss: string[];
16
+ extraJs: string[];
17
+ fitRatio: number;
18
+ initialExpandLevel: number;
19
+ maxInitialScale: number;
20
+ maxWidth: number;
21
+ nodeMinHeight: number;
22
+ paddingX: number;
23
+ pan: boolean;
24
+ spacingHorizontal: number;
25
+ spacingVertical: number;
26
+ zoom: boolean;
27
+ htmlParser: any;
28
+ }>;
24
29
  export interface IPadding {
25
30
  left: number;
26
31
  right: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markmap-view",
3
- "version": "0.17.1-alpha.5+a813e1e",
3
+ "version": "0.17.2",
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.17.0"
49
+ "markmap-common": "0.17.1"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "markmap-common": "*"
53
53
  },
54
- "gitHead": "a813e1efd3ad5a1f011fd71320bc36ac3e2b2402"
54
+ "gitHead": "bbeec32d0efeea4e36755b1909a5993187264487"
55
55
  }