markmap-view 0.2.5 → 0.13.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! markmap-view v0.2.5 | MIT License */
1
+ /*! markmap-view v0.13.0-alpha.0 | MIT License */
2
2
  (function (exports, d3) {
3
3
  'use strict';
4
4
 
@@ -6,16 +6,44 @@ function _interopNamespace(e) {
6
6
  if (e && e.__esModule) return e;
7
7
  var n = Object.create(null);
8
8
  if (e) {
9
- Object.keys(e).forEach(function (k) {
9
+ for (var k in e) {
10
10
  n[k] = e[k];
11
- });
12
11
  }
13
- n['default'] = e;
12
+ }
13
+ n["default"] = e;
14
14
  return Object.freeze(n);
15
15
  }
16
16
 
17
17
  var d3__namespace = /*#__PURE__*/_interopNamespace(d3);
18
18
 
19
+ /*! markmap-common v0.13.0-alpha.0 | MIT License */
20
+ class Hook {
21
+ constructor() {
22
+ this.listeners = [];
23
+ }
24
+
25
+ tap(fn) {
26
+ this.listeners.push(fn);
27
+ return () => this.revoke(fn);
28
+ }
29
+
30
+ revoke(fn) {
31
+ const i = this.listeners.indexOf(fn);
32
+ if (i >= 0) this.listeners.splice(i, 1);
33
+ }
34
+
35
+ revokeAll() {
36
+ this.listeners.splice(0);
37
+ }
38
+
39
+ call(...args) {
40
+ for (const fn of this.listeners) {
41
+ fn(...args);
42
+ }
43
+ }
44
+
45
+ }
46
+
19
47
  function _extends$1() {
20
48
  _extends$1 = Object.assign || function (target) {
21
49
  for (var i = 1; i < arguments.length; i++) {
@@ -34,52 +62,186 @@ function _extends$1() {
34
62
  return _extends$1.apply(this, arguments);
35
63
  }
36
64
 
37
- function _assertThisInitialized(self) {
38
- if (self === void 0) {
39
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
40
- }
65
+ const uniqId = Math.random().toString(36).slice(2, 8);
66
+ let globalIndex = 0;
41
67
 
42
- return self;
68
+ function getId() {
69
+ globalIndex += 1;
70
+ return `mm-${uniqId}-${globalIndex}`;
71
+ }
72
+
73
+ function noop() {// noop
74
+ }
75
+
76
+ function walkTree(tree, callback, key = 'children') {
77
+ const walk = (item, parent) => callback(item, () => {
78
+ var _item$key;
79
+
80
+ (_item$key = item[key]) == null ? void 0 : _item$key.forEach(child => {
81
+ walk(child, item);
82
+ });
83
+ }, parent);
84
+
85
+ walk(tree);
43
86
  }
44
87
 
45
- function _defineProperties(target, props) {
46
- for (var i = 0; i < props.length; i++) {
47
- var descriptor = props[i];
48
- descriptor.enumerable = descriptor.enumerable || false;
49
- descriptor.configurable = true;
50
- if ("value" in descriptor) descriptor.writable = true;
51
- Object.defineProperty(target, descriptor.key, descriptor);
88
+ function arrayFrom(arrayLike) {
89
+ if (Array.from) return Array.from(arrayLike);
90
+ const array = [];
91
+
92
+ for (let i = 0; i < arrayLike.length; i += 1) {
93
+ array.push(arrayLike[i]);
52
94
  }
95
+
96
+ return array;
97
+ }
98
+
99
+ function addClass(className, ...rest) {
100
+ const classList = (className || '').split(' ').filter(Boolean);
101
+ rest.forEach(item => {
102
+ if (item && classList.indexOf(item) < 0) classList.push(item);
103
+ });
104
+ return classList.join(' ');
53
105
  }
54
106
 
55
- function _createClass(Constructor, protoProps, staticProps) {
56
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
57
- if (staticProps) _defineProperties(Constructor, staticProps);
58
- return Constructor;
107
+ function childSelector(filter) {
108
+ if (typeof filter === 'string') {
109
+ const tagName = filter;
110
+
111
+ filter = el => el.tagName === tagName;
112
+ }
113
+
114
+ const filterFn = filter;
115
+ return function selector() {
116
+ let nodes = arrayFrom(this.childNodes);
117
+ if (filterFn) nodes = nodes.filter(node => filterFn(node));
118
+ return nodes;
119
+ };
59
120
  }
60
121
 
61
- function _setPrototypeOf(o, p) {
62
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
63
- o.__proto__ = p;
64
- return o;
122
+ function memoize(fn) {
123
+ const cache = {};
124
+ return function memoized(...args) {
125
+ const key = `${args[0]}`;
126
+ let data = cache[key];
127
+
128
+ if (!data) {
129
+ data = {
130
+ value: fn(...args)
131
+ };
132
+ cache[key] = data;
133
+ }
134
+
135
+ return data.value;
65
136
  };
137
+ }
138
+
139
+ function createElement(tagName, props, attrs) {
140
+ const el = document.createElement(tagName);
141
+
142
+ if (props) {
143
+ Object.entries(props).forEach(([key, value]) => {
144
+ el[key] = value;
145
+ });
146
+ }
147
+
148
+ if (attrs) {
149
+ Object.entries(attrs).forEach(([key, value]) => {
150
+ el.setAttribute(key, value);
151
+ });
152
+ }
153
+
154
+ return el;
155
+ }
156
+
157
+ const memoizedPreloadJS = memoize(url => {
158
+ document.head.append(createElement('link', {
159
+ rel: 'preload',
160
+ as: 'script',
161
+ href: url
162
+ }));
163
+ });
164
+
165
+ function loadJSItem(item, context) {
166
+ if (item.type === 'script') {
167
+ return new Promise((resolve, reject) => {
168
+ var _item$data;
169
+
170
+ document.head.append(createElement('script', _extends$1({}, item.data, {
171
+ onload: resolve,
172
+ onerror: reject
173
+ }))); // Run inline script synchronously
66
174
 
67
- return _setPrototypeOf(o, p);
175
+ if (!((_item$data = item.data) != null && _item$data.src)) resolve();
176
+ });
177
+ }
178
+
179
+ if (item.type === 'iife') {
180
+ const {
181
+ fn,
182
+ getParams
183
+ } = item.data;
184
+ fn(...((getParams == null ? void 0 : getParams(context)) || []));
185
+ }
186
+ }
187
+
188
+ function loadCSSItem(item) {
189
+ if (item.type === 'style') {
190
+ document.head.append(createElement('style', {
191
+ textContent: item.data
192
+ }));
193
+ } else if (item.type === 'stylesheet') {
194
+ document.head.append(createElement('link', _extends$1({
195
+ rel: 'stylesheet'
196
+ }, item.data)));
197
+ }
198
+ }
199
+
200
+ async function loadJS(items, context) {
201
+ const needPreload = items.filter(item => {
202
+ var _item$data2;
203
+
204
+ return item.type === 'script' && ((_item$data2 = item.data) == null ? void 0 : _item$data2.src);
205
+ });
206
+ if (needPreload.length > 1) needPreload.forEach(item => memoizedPreloadJS(item.data.src));
207
+ context = _extends$1({
208
+ getMarkmap: () => window.markmap
209
+ }, context);
210
+
211
+ for (const item of items) {
212
+ await loadJSItem(item, context);
213
+ }
214
+ }
215
+
216
+ function loadCSS(items) {
217
+ for (const item of items) {
218
+ loadCSSItem(item);
219
+ }
68
220
  }
69
221
 
70
- function _inheritsLoose(subClass, superClass) {
71
- subClass.prototype = Object.create(superClass.prototype);
72
- subClass.prototype.constructor = subClass;
73
- _setPrototypeOf(subClass, superClass);
222
+ function _extends() {
223
+ _extends = Object.assign || function (target) {
224
+ for (var i = 1; i < arguments.length; i++) {
225
+ var source = arguments[i];
226
+
227
+ for (var key in source) {
228
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
229
+ target[key] = source[key];
230
+ }
231
+ }
232
+ }
233
+
234
+ return target;
235
+ };
236
+
237
+ return _extends.apply(this, arguments);
74
238
  }
75
239
 
76
240
  function count(node) {
77
241
  var sum = 0,
78
242
  children = node.children,
79
243
  i = children && children.length;
80
- if (!i) sum = 1;else while (--i >= 0) {
81
- sum += children[i].value;
82
- }
244
+ if (!i) sum = 1;else while (--i >= 0) sum += children[i].value;
83
245
  node.value = sum;
84
246
  }
85
247
 
@@ -153,9 +315,7 @@ function node_sum (value) {
153
315
  children = node.children,
154
316
  i = children && children.length;
155
317
 
156
- while (--i >= 0) {
157
- sum += children[i].value;
158
- }
318
+ while (--i >= 0) sum += children[i].value;
159
319
 
160
320
  node.value = sum;
161
321
  });
@@ -251,7 +411,7 @@ function node_links () {
251
411
  }
252
412
 
253
413
  function hierarchy(data, children) {
254
- var root = new Node(data),
414
+ var root = new Node$1(data),
255
415
  valued = +data.value && (root.value = data.value),
256
416
  node,
257
417
  nodes = [root],
@@ -268,7 +428,7 @@ function hierarchy(data, children) {
268
428
  node.children = new Array(n);
269
429
 
270
430
  for (i = n - 1; i >= 0; --i) {
271
- nodes.push(child = node.children[i] = new Node(childs[i]));
431
+ nodes.push(child = node.children[i] = new Node$1(childs[i]));
272
432
  child.parent = node;
273
433
  child.depth = node.depth + 1;
274
434
  }
@@ -293,17 +453,15 @@ function copyData(node) {
293
453
  function computeHeight(node) {
294
454
  var height = 0;
295
455
 
296
- do {
297
- node.height = height;
298
- } while ((node = node.parent) && node.height < ++height);
456
+ do node.height = height; while ((node = node.parent) && node.height < ++height);
299
457
  }
300
- function Node(data) {
458
+ function Node$1(data) {
301
459
  this.data = data;
302
460
  this.depth = this.height = 0;
303
461
  this.parent = null;
304
462
  }
305
- Node.prototype = hierarchy.prototype = {
306
- constructor: Node,
463
+ Node$1.prototype = hierarchy.prototype = {
464
+ constructor: Node$1,
307
465
  count: node_count,
308
466
  each: node_each,
309
467
  eachAfter: node_eachAfter,
@@ -318,15 +476,90 @@ Node.prototype = hierarchy.prototype = {
318
476
  copy: node_copy
319
477
  };
320
478
 
321
- var version = "2.1.1";
479
+ var name = "d3-flextree";
480
+ var version$1 = "2.1.2";
481
+ var main = "build/d3-flextree.js";
482
+ var module = "index";
483
+ var author = {
484
+ name: "Chris Maloney",
485
+ url: "http://chrismaloney.org"
486
+ };
487
+ var description = "Flexible tree layout algorithm that allows for variable node sizes.";
488
+ var keywords = [
489
+ "d3",
490
+ "d3-module",
491
+ "layout",
492
+ "tree",
493
+ "hierarchy",
494
+ "d3-hierarchy",
495
+ "plugin",
496
+ "d3-plugin",
497
+ "infovis",
498
+ "visualization",
499
+ "2d"
500
+ ];
501
+ var homepage = "https://github.com/klortho/d3-flextree";
502
+ var license = "WTFPL";
503
+ var repository = {
504
+ type: "git",
505
+ url: "https://github.com/klortho/d3-flextree.git"
506
+ };
507
+ var scripts = {
508
+ clean: "rm -rf build demo test",
509
+ "build:demo": "rollup -c --environment BUILD:demo",
510
+ "build:dev": "rollup -c --environment BUILD:dev",
511
+ "build:prod": "rollup -c --environment BUILD:prod",
512
+ "build:test": "rollup -c --environment BUILD:test",
513
+ build: "rollup -c",
514
+ lint: "eslint index.js src",
515
+ "test:main": "node test/bundle.js",
516
+ "test:browser": "node test/browser-tests.js",
517
+ test: "npm-run-all test:*",
518
+ prepare: "npm-run-all clean build lint test"
519
+ };
520
+ var dependencies = {
521
+ "d3-hierarchy": "^1.1.5"
522
+ };
523
+ var devDependencies = {
524
+ "babel-plugin-external-helpers": "^6.22.0",
525
+ "babel-preset-es2015-rollup": "^3.0.0",
526
+ d3: "^4.13.0",
527
+ "d3-selection-multi": "^1.0.1",
528
+ eslint: "^4.19.1",
529
+ jsdom: "^11.6.2",
530
+ "npm-run-all": "^4.1.2",
531
+ rollup: "^0.55.3",
532
+ "rollup-plugin-babel": "^2.7.1",
533
+ "rollup-plugin-commonjs": "^8.0.2",
534
+ "rollup-plugin-copy": "^0.2.3",
535
+ "rollup-plugin-json": "^2.3.0",
536
+ "rollup-plugin-node-resolve": "^3.0.2",
537
+ "rollup-plugin-uglify": "^3.0.0",
538
+ "uglify-es": "^3.3.9"
539
+ };
540
+ var packageInfo = {
541
+ name: name,
542
+ version: version$1,
543
+ main: main,
544
+ module: module,
545
+ "jsnext:main": "index",
546
+ author: author,
547
+ description: description,
548
+ keywords: keywords,
549
+ homepage: homepage,
550
+ license: license,
551
+ repository: repository,
552
+ scripts: scripts,
553
+ dependencies: dependencies,
554
+ devDependencies: devDependencies
555
+ };
322
556
 
323
- var defaults = Object.freeze({
324
- children: function children(data) {
325
- return data.children;
326
- },
327
- nodeSize: function nodeSize(node) {
328
- return node.data.size;
329
- },
557
+ const {
558
+ version
559
+ } = packageInfo;
560
+ const defaults = Object.freeze({
561
+ children: data => data.children,
562
+ nodeSize: node => node.data.size,
330
563
  spacing: 0
331
564
  }); // Create a layout function with customizable options. Per D3-style, the
332
565
  // options can be set at any time using setter methods. The layout function
@@ -334,244 +567,192 @@ var defaults = Object.freeze({
334
567
  // time it is called.
335
568
 
336
569
  function flextree(options) {
337
- var opts = Object.assign({}, defaults, options);
570
+ const opts = Object.assign({}, defaults, options);
338
571
 
339
572
  function accessor(name) {
340
- var opt = opts[name];
341
- return typeof opt === 'function' ? opt : function () {
342
- return opt;
343
- };
573
+ const opt = opts[name];
574
+ return typeof opt === 'function' ? opt : () => opt;
344
575
  }
345
576
 
346
577
  function layout(tree) {
347
- var wtree = wrap(getWrapper(), tree, function (node) {
348
- return node.children;
349
- });
578
+ const wtree = wrap(getWrapper(), tree, node => node.children);
350
579
  wtree.update();
351
580
  return wtree.data;
352
581
  }
353
582
 
354
583
  function getFlexNode() {
355
- var nodeSize = accessor('nodeSize');
584
+ const nodeSize = accessor('nodeSize');
585
+ const spacing = accessor('spacing');
586
+ return class FlexNode extends hierarchy.prototype.constructor {
587
+ constructor(data) {
588
+ super(data);
589
+ }
356
590
 
357
- var _spacing = accessor('spacing');
591
+ copy() {
592
+ const c = wrap(this.constructor, this, node => node.children);
593
+ c.each(node => node.data = node.data.data);
594
+ return c;
595
+ }
358
596
 
359
- return /*#__PURE__*/function (_hierarchy$prototype$) {
360
- _inheritsLoose(FlexNode, _hierarchy$prototype$);
597
+ get size() {
598
+ return nodeSize(this);
599
+ }
361
600
 
362
- function FlexNode(data) {
363
- return _hierarchy$prototype$.call(this, data) || this;
601
+ spacing(oNode) {
602
+ return spacing(this, oNode);
364
603
  }
365
604
 
366
- var _proto = FlexNode.prototype;
605
+ get nodes() {
606
+ return this.descendants();
607
+ }
367
608
 
368
- _proto.copy = function copy() {
369
- var c = wrap(this.constructor, this, function (node) {
370
- return node.children;
371
- });
372
- c.each(function (node) {
373
- return node.data = node.data.data;
374
- });
375
- return c;
376
- };
609
+ get xSize() {
610
+ return this.size[0];
611
+ }
377
612
 
378
- _proto.spacing = function spacing(oNode) {
379
- return _spacing(this, oNode);
380
- };
613
+ get ySize() {
614
+ return this.size[1];
615
+ }
616
+
617
+ get top() {
618
+ return this.y;
619
+ }
620
+
621
+ get bottom() {
622
+ return this.y + this.ySize;
623
+ }
624
+
625
+ get left() {
626
+ return this.x - this.xSize / 2;
627
+ }
628
+
629
+ get right() {
630
+ return this.x + this.xSize / 2;
631
+ }
632
+
633
+ get root() {
634
+ const ancs = this.ancestors();
635
+ return ancs[ancs.length - 1];
636
+ }
637
+
638
+ get numChildren() {
639
+ return this.hasChildren ? this.children.length : 0;
640
+ }
641
+
642
+ get hasChildren() {
643
+ return !this.noChildren;
644
+ }
381
645
 
382
- FlexNode.maxExtents = function maxExtents(e0, e1) {
646
+ get noChildren() {
647
+ return this.children === null;
648
+ }
649
+
650
+ get firstChild() {
651
+ return this.hasChildren ? this.children[0] : null;
652
+ }
653
+
654
+ get lastChild() {
655
+ return this.hasChildren ? this.children[this.numChildren - 1] : null;
656
+ }
657
+
658
+ get extents() {
659
+ return (this.children || []).reduce((acc, kid) => FlexNode.maxExtents(acc, kid.extents), this.nodeExtents);
660
+ }
661
+
662
+ get nodeExtents() {
663
+ return {
664
+ top: this.top,
665
+ bottom: this.bottom,
666
+ left: this.left,
667
+ right: this.right
668
+ };
669
+ }
670
+
671
+ static maxExtents(e0, e1) {
383
672
  return {
384
673
  top: Math.min(e0.top, e1.top),
385
674
  bottom: Math.max(e0.bottom, e1.bottom),
386
675
  left: Math.min(e0.left, e1.left),
387
676
  right: Math.max(e0.right, e1.right)
388
677
  };
389
- };
390
-
391
- _createClass(FlexNode, [{
392
- key: "size",
393
- get: function get() {
394
- return nodeSize(this);
395
- }
396
- }, {
397
- key: "nodes",
398
- get: function get() {
399
- return this.descendants();
400
- }
401
- }, {
402
- key: "xSize",
403
- get: function get() {
404
- return this.size[0];
405
- }
406
- }, {
407
- key: "ySize",
408
- get: function get() {
409
- return this.size[1];
410
- }
411
- }, {
412
- key: "top",
413
- get: function get() {
414
- return this.y;
415
- }
416
- }, {
417
- key: "bottom",
418
- get: function get() {
419
- return this.y + this.ySize;
420
- }
421
- }, {
422
- key: "left",
423
- get: function get() {
424
- return this.x - this.xSize / 2;
425
- }
426
- }, {
427
- key: "right",
428
- get: function get() {
429
- return this.x + this.xSize / 2;
430
- }
431
- }, {
432
- key: "root",
433
- get: function get() {
434
- var ancs = this.ancestors();
435
- return ancs[ancs.length - 1];
436
- }
437
- }, {
438
- key: "numChildren",
439
- get: function get() {
440
- return this.hasChildren ? this.children.length : 0;
441
- }
442
- }, {
443
- key: "hasChildren",
444
- get: function get() {
445
- return !this.noChildren;
446
- }
447
- }, {
448
- key: "noChildren",
449
- get: function get() {
450
- return this.children === null;
451
- }
452
- }, {
453
- key: "firstChild",
454
- get: function get() {
455
- return this.hasChildren ? this.children[0] : null;
456
- }
457
- }, {
458
- key: "lastChild",
459
- get: function get() {
460
- return this.hasChildren ? this.children[this.numChildren - 1] : null;
461
- }
462
- }, {
463
- key: "extents",
464
- get: function get() {
465
- return (this.children || []).reduce(function (acc, kid) {
466
- return FlexNode.maxExtents(acc, kid.extents);
467
- }, this.nodeExtents);
468
- }
469
- }, {
470
- key: "nodeExtents",
471
- get: function get() {
472
- return {
473
- top: this.top,
474
- bottom: this.bottom,
475
- left: this.left,
476
- right: this.right
477
- };
478
- }
479
- }]);
678
+ }
480
679
 
481
- return FlexNode;
482
- }(hierarchy.prototype.constructor);
680
+ };
483
681
  }
484
682
 
485
683
  function getWrapper() {
486
- var FlexNode = getFlexNode();
487
- var nodeSize = accessor('nodeSize');
488
-
489
- var _spacing2 = accessor('spacing');
490
-
491
- return /*#__PURE__*/function (_FlexNode) {
492
- _inheritsLoose(_class, _FlexNode);
493
-
494
- function _class(data) {
495
- var _this;
496
-
497
- _this = _FlexNode.call(this, data) || this;
498
- Object.assign(_assertThisInitialized(_this), {
684
+ const FlexNode = getFlexNode();
685
+ const nodeSize = accessor('nodeSize');
686
+ const spacing = accessor('spacing');
687
+ return class extends FlexNode {
688
+ constructor(data) {
689
+ super(data);
690
+ Object.assign(this, {
499
691
  x: 0,
500
692
  y: 0,
501
693
  relX: 0,
502
694
  prelim: 0,
503
695
  shift: 0,
504
696
  change: 0,
505
- lExt: _assertThisInitialized(_this),
697
+ lExt: this,
506
698
  lExtRelX: 0,
507
699
  lThr: null,
508
- rExt: _assertThisInitialized(_this),
700
+ rExt: this,
509
701
  rExtRelX: 0,
510
702
  rThr: null
511
703
  });
512
- return _this;
513
704
  }
514
705
 
515
- var _proto2 = _class.prototype;
706
+ get size() {
707
+ return nodeSize(this.data);
708
+ }
516
709
 
517
- _proto2.spacing = function spacing(oNode) {
518
- return _spacing2(this.data, oNode.data);
519
- };
710
+ spacing(oNode) {
711
+ return spacing(this.data, oNode.data);
712
+ }
713
+
714
+ get x() {
715
+ return this.data.x;
716
+ }
717
+
718
+ set x(v) {
719
+ this.data.x = v;
720
+ }
721
+
722
+ get y() {
723
+ return this.data.y;
724
+ }
725
+
726
+ set y(v) {
727
+ this.data.y = v;
728
+ }
520
729
 
521
- _proto2.update = function update() {
730
+ update() {
522
731
  layoutChildren(this);
523
732
  resolveX(this);
524
733
  return this;
525
- };
526
-
527
- _createClass(_class, [{
528
- key: "size",
529
- get: function get() {
530
- return nodeSize(this.data);
531
- }
532
- }, {
533
- key: "x",
534
- get: function get() {
535
- return this.data.x;
536
- },
537
- set: function set(v) {
538
- this.data.x = v;
539
- }
540
- }, {
541
- key: "y",
542
- get: function get() {
543
- return this.data.y;
544
- },
545
- set: function set(v) {
546
- this.data.y = v;
547
- }
548
- }]);
734
+ }
549
735
 
550
- return _class;
551
- }(FlexNode);
736
+ };
552
737
  }
553
738
 
554
739
  function wrap(FlexClass, treeData, children) {
555
- var _wrap = function _wrap(data, parent) {
556
- var node = new FlexClass(data);
740
+ const _wrap = (data, parent) => {
741
+ const node = new FlexClass(data);
557
742
  Object.assign(node, {
558
- parent: parent,
743
+ parent,
559
744
  depth: parent === null ? 0 : parent.depth + 1,
560
745
  height: 0,
561
746
  length: 1
562
747
  });
563
- var kidsData = children(data) || [];
564
- node.children = kidsData.length === 0 ? null : kidsData.map(function (kd) {
565
- return _wrap(kd, node);
566
- });
748
+ const kidsData = children(data) || [];
749
+ node.children = kidsData.length === 0 ? null : kidsData.map(kd => _wrap(kd, node));
567
750
 
568
751
  if (node.children) {
569
- Object.assign(node, node.children.reduce(function (hl, kid) {
570
- return {
571
- height: Math.max(hl.height, kid.height + 1),
572
- length: hl.length + kid.length
573
- };
574
- }, node));
752
+ Object.assign(node, node.children.reduce((hl, kid) => ({
753
+ height: Math.max(hl.height, kid.height + 1),
754
+ length: hl.length + kid.length
755
+ }), node));
575
756
  }
576
757
 
577
758
  return node;
@@ -581,57 +762,57 @@ function flextree(options) {
581
762
  }
582
763
 
583
764
  Object.assign(layout, {
584
- nodeSize: function nodeSize(arg) {
765
+ nodeSize(arg) {
585
766
  return arguments.length ? (opts.nodeSize = arg, layout) : opts.nodeSize;
586
767
  },
587
- spacing: function spacing(arg) {
768
+
769
+ spacing(arg) {
588
770
  return arguments.length ? (opts.spacing = arg, layout) : opts.spacing;
589
771
  },
590
- children: function children(arg) {
772
+
773
+ children(arg) {
591
774
  return arguments.length ? (opts.children = arg, layout) : opts.children;
592
775
  },
593
- hierarchy: function hierarchy(treeData, children) {
594
- var kids = typeof children === 'undefined' ? opts.children : children;
776
+
777
+ hierarchy(treeData, children) {
778
+ const kids = typeof children === 'undefined' ? opts.children : children;
595
779
  return wrap(getFlexNode(), treeData, kids);
596
780
  },
597
- dump: function dump(tree) {
598
- var nodeSize = accessor('nodeSize');
599
-
600
- var _dump = function _dump(i0) {
601
- return function (node) {
602
- var i1 = i0 + ' ';
603
- var i2 = i0 + ' ';
604
- var x = node.x,
605
- y = node.y;
606
- var size = nodeSize(node);
607
- var kids = node.children || [];
608
- var kdumps = kids.length === 0 ? ' ' : "," + i1 + "children: [" + i2 + kids.map(_dump(i2)).join(i2) + i1 + "]," + i0;
609
- return "{ size: [" + size.join(', ') + "]," + i1 + "x: " + x + ", y: " + y + kdumps + "},";
610
- };
781
+
782
+ dump(tree) {
783
+ const nodeSize = accessor('nodeSize');
784
+
785
+ const _dump = i0 => node => {
786
+ const i1 = i0 + ' ';
787
+ const i2 = i0 + ' ';
788
+ const {
789
+ x,
790
+ y
791
+ } = node;
792
+ const size = nodeSize(node);
793
+ const kids = node.children || [];
794
+ const kdumps = kids.length === 0 ? ' ' : `,${i1}children: [${i2}${kids.map(_dump(i2)).join(i2)}${i1}],${i0}`;
795
+ return `{ size: [${size.join(', ')}],${i1}x: ${x}, y: ${y}${kdumps}},`;
611
796
  };
612
797
 
613
798
  return _dump('\n')(tree);
614
799
  }
800
+
615
801
  });
616
802
  return layout;
617
803
  }
618
804
  flextree.version = version;
619
805
 
620
- var layoutChildren = function layoutChildren(w, y) {
621
- if (y === void 0) {
622
- y = 0;
623
- }
624
-
806
+ const layoutChildren = (w, y = 0) => {
625
807
  w.y = y;
626
- (w.children || []).reduce(function (acc, kid) {
627
- var i = acc[0],
628
- lastLows = acc[1];
808
+ (w.children || []).reduce((acc, kid) => {
809
+ const [i, lastLows] = acc;
629
810
  layoutChildren(kid, w.y + w.ySize); // The lowest vertical coordinate while extreme nodes still point
630
811
  // in current subtree.
631
812
 
632
- var lowY = (i === 0 ? kid.lExt : kid.rExt).bottom;
813
+ const lowY = (i === 0 ? kid.lExt : kid.rExt).bottom;
633
814
  if (i !== 0) separate(w, i, lastLows);
634
- var lows = updateLows(lowY, i, lastLows);
815
+ const lows = updateLows(lowY, i, lastLows);
635
816
  return [i + 1, lows];
636
817
  }, [0, null]);
637
818
  shiftChange(w);
@@ -643,7 +824,7 @@ var layoutChildren = function layoutChildren(w, y) {
643
824
  // to its parent.
644
825
 
645
826
 
646
- var resolveX = function resolveX(w, prevSum, parentX) {
827
+ const resolveX = (w, prevSum, parentX) => {
647
828
  // A call to resolveX without arguments is assumed to be for the root of
648
829
  // the tree. This will set the root's x-coord to zero.
649
830
  if (typeof prevSum === 'undefined') {
@@ -651,24 +832,21 @@ var resolveX = function resolveX(w, prevSum, parentX) {
651
832
  parentX = 0;
652
833
  }
653
834
 
654
- var sum = prevSum + w.relX;
835
+ const sum = prevSum + w.relX;
655
836
  w.relX = sum + w.prelim - parentX;
656
837
  w.prelim = 0;
657
838
  w.x = parentX + w.relX;
658
- (w.children || []).forEach(function (k) {
659
- return resolveX(k, sum, w.x);
660
- });
839
+ (w.children || []).forEach(k => resolveX(k, sum, w.x));
661
840
  return w;
662
841
  }; // Process shift and change for all children, to add intermediate spacing to
663
842
  // each child's modifier.
664
843
 
665
844
 
666
- var shiftChange = function shiftChange(w) {
667
- (w.children || []).reduce(function (acc, child) {
668
- var lastShiftSum = acc[0],
669
- lastChangeSum = acc[1];
670
- var shiftSum = lastShiftSum + child.shift;
671
- var changeSum = lastChangeSum + shiftSum + child.change;
845
+ const shiftChange = w => {
846
+ (w.children || []).reduce((acc, child) => {
847
+ const [lastShiftSum, lastChangeSum] = acc;
848
+ const shiftSum = lastShiftSum + child.shift;
849
+ const changeSum = lastChangeSum + shiftSum + child.change;
672
850
  child.relX += changeSum;
673
851
  return [shiftSum, changeSum];
674
852
  }, [0, 0]);
@@ -677,21 +855,21 @@ var shiftChange = function shiftChange(w) {
677
855
  /* eslint-disable complexity */
678
856
 
679
857
 
680
- var separate = function separate(w, i, lows) {
681
- var lSib = w.children[i - 1];
682
- var curSubtree = w.children[i];
683
- var rContour = lSib;
684
- var rSumMods = lSib.relX;
685
- var lContour = curSubtree;
686
- var lSumMods = curSubtree.relX;
687
- var isFirst = true;
858
+ const separate = (w, i, lows) => {
859
+ const lSib = w.children[i - 1];
860
+ const curSubtree = w.children[i];
861
+ let rContour = lSib;
862
+ let rSumMods = lSib.relX;
863
+ let lContour = curSubtree;
864
+ let lSumMods = curSubtree.relX;
865
+ let isFirst = true;
688
866
 
689
867
  while (rContour && lContour) {
690
868
  if (rContour.bottom > lows.lowY) lows = lows.next; // How far to the left of the right side of rContour is the left side
691
869
  // of lContour? First compute the center-to-center distance, then add
692
870
  // the "spacing"
693
871
 
694
- var dist = rSumMods + rContour.prelim - (lSumMods + lContour.prelim) + rContour.xSize / 2 + lContour.xSize / 2 + rContour.spacing(lContour);
872
+ const dist = rSumMods + rContour.prelim - (lSumMods + lContour.prelim) + rContour.xSize / 2 + lContour.xSize / 2 + rContour.spacing(lContour);
695
873
 
696
874
  if (dist > 0 || dist < 0 && isFirst) {
697
875
  lSumMods += dist; // Move subtree by changing relX.
@@ -702,8 +880,8 @@ var separate = function separate(w, i, lows) {
702
880
 
703
881
  isFirst = false; // Advance highest node(s) and sum(s) of modifiers
704
882
 
705
- var rightBottom = rContour.bottom;
706
- var leftBottom = lContour.bottom;
883
+ const rightBottom = rContour.bottom;
884
+ const leftBottom = lContour.bottom;
707
885
 
708
886
  if (rightBottom <= leftBottom) {
709
887
  rContour = nextRContour(rContour);
@@ -725,39 +903,39 @@ var separate = function separate(w, i, lows) {
725
903
  // Move subtree by changing relX.
726
904
 
727
905
 
728
- var moveSubtree = function moveSubtree(subtree, distance) {
906
+ const moveSubtree = (subtree, distance) => {
729
907
  subtree.relX += distance;
730
908
  subtree.lExtRelX += distance;
731
909
  subtree.rExtRelX += distance;
732
910
  };
733
911
 
734
- var distributeExtra = function distributeExtra(w, curSubtreeI, leftSibI, dist) {
735
- var curSubtree = w.children[curSubtreeI];
736
- var n = curSubtreeI - leftSibI; // Are there intermediate children?
912
+ const distributeExtra = (w, curSubtreeI, leftSibI, dist) => {
913
+ const curSubtree = w.children[curSubtreeI];
914
+ const n = curSubtreeI - leftSibI; // Are there intermediate children?
737
915
 
738
916
  if (n > 1) {
739
- var delta = dist / n;
917
+ const delta = dist / n;
740
918
  w.children[leftSibI + 1].shift += delta;
741
919
  curSubtree.shift -= delta;
742
920
  curSubtree.change -= dist - delta;
743
921
  }
744
922
  };
745
923
 
746
- var nextLContour = function nextLContour(w) {
924
+ const nextLContour = w => {
747
925
  return w.hasChildren ? w.firstChild : w.lThr;
748
926
  };
749
927
 
750
- var nextRContour = function nextRContour(w) {
928
+ const nextRContour = w => {
751
929
  return w.hasChildren ? w.lastChild : w.rThr;
752
930
  };
753
931
 
754
- var setLThr = function setLThr(w, i, lContour, lSumMods) {
755
- var firstChild = w.firstChild;
756
- var lExt = firstChild.lExt;
757
- var curSubtree = w.children[i];
932
+ const setLThr = (w, i, lContour, lSumMods) => {
933
+ const firstChild = w.firstChild;
934
+ const lExt = firstChild.lExt;
935
+ const curSubtree = w.children[i];
758
936
  lExt.lThr = lContour; // Change relX so that the sum of modifier after following thread is correct.
759
937
 
760
- var diff = lSumMods - lContour.relX - firstChild.lExtRelX;
938
+ const diff = lSumMods - lContour.relX - firstChild.lExtRelX;
761
939
  lExt.relX += diff; // Change preliminary x coordinate so that the node does not move.
762
940
 
763
941
  lExt.prelim -= diff; // Update extreme node and its sum of modifiers.
@@ -767,12 +945,12 @@ var setLThr = function setLThr(w, i, lContour, lSumMods) {
767
945
  }; // Mirror image of setLThr.
768
946
 
769
947
 
770
- var setRThr = function setRThr(w, i, rContour, rSumMods) {
771
- var curSubtree = w.children[i];
772
- var rExt = curSubtree.rExt;
773
- var lSib = w.children[i - 1];
948
+ const setRThr = (w, i, rContour, rSumMods) => {
949
+ const curSubtree = w.children[i];
950
+ const rExt = curSubtree.rExt;
951
+ const lSib = w.children[i - 1];
774
952
  rExt.rThr = rContour;
775
- var diff = rSumMods - rContour.relX - curSubtree.rExtRelX;
953
+ const diff = rSumMods - rContour.relX - curSubtree.rExtRelX;
776
954
  rExt.relX += diff;
777
955
  rExt.prelim -= diff;
778
956
  curSubtree.rExt = lSib.rExt;
@@ -780,13 +958,13 @@ var setRThr = function setRThr(w, i, rContour, rSumMods) {
780
958
  }; // Position root between children, taking into account their modifiers
781
959
 
782
960
 
783
- var positionRoot = function positionRoot(w) {
961
+ const positionRoot = w => {
784
962
  if (w.hasChildren) {
785
- var k0 = w.firstChild;
786
- var kf = w.lastChild;
787
- var prelim = (k0.prelim + k0.relX - k0.xSize / 2 + kf.relX + kf.prelim + kf.xSize / 2) / 2;
963
+ const k0 = w.firstChild;
964
+ const kf = w.lastChild;
965
+ const prelim = (k0.prelim + k0.relX - k0.xSize / 2 + kf.relX + kf.prelim + kf.xSize / 2) / 2;
788
966
  Object.assign(w, {
789
- prelim: prelim,
967
+ prelim,
790
968
  lExt: k0.lExt,
791
969
  lExtRelX: k0.lExtRelX,
792
970
  rExt: kf.rExt,
@@ -797,226 +975,257 @@ var positionRoot = function positionRoot(w) {
797
975
  // lowest vertical coordinate.
798
976
 
799
977
 
800
- var updateLows = function updateLows(lowY, index, lastLows) {
978
+ const updateLows = (lowY, index, lastLows) => {
801
979
  // Remove siblings that are hidden by the new subtree.
802
- while (lastLows !== null && lowY >= lastLows.lowY) {
803
- lastLows = lastLows.next;
804
- } // Prepend the new subtree.
980
+ while (lastLows !== null && lowY >= lastLows.lowY) lastLows = lastLows.next; // Prepend the new subtree.
805
981
 
806
982
 
807
983
  return {
808
- lowY: lowY,
809
- index: index,
984
+ lowY,
985
+ index,
810
986
  next: lastLows
811
987
  };
812
988
  };
813
989
 
814
- /*! markmap-common v0.1.5 | MIT License */
815
- class Hook {
816
- constructor() {
817
- this.listeners = [];
818
- }
990
+ /*! @gera2ld/jsx-dom v2.1.1 | ISC License */
991
+ var VTYPE_ELEMENT = 1;
992
+ var VTYPE_FUNCTION = 2;
993
+ var MOUNT_SINGLE = 1;
994
+ var MOUNT_ARRAY = 4;
995
+ var SVG_NS = 'http://www.w3.org/2000/svg';
996
+ var XLINK_NS = 'http://www.w3.org/1999/xlink';
997
+ var NS_ATTRS = {
998
+ show: XLINK_NS,
999
+ actuate: XLINK_NS,
1000
+ href: XLINK_NS
1001
+ };
819
1002
 
820
- tap(fn) {
821
- this.listeners.push(fn);
822
- return () => this.revoke(fn);
823
- }
1003
+ var isLeaf = function isLeaf(c) {
1004
+ return typeof c === 'string' || typeof c === 'number';
1005
+ };
824
1006
 
825
- revoke(fn) {
826
- const i = this.listeners.indexOf(fn);
827
- if (i >= 0) this.listeners.splice(i, 1);
828
- }
1007
+ var isElement = function isElement(c) {
1008
+ return (c == null ? void 0 : c.vtype) === VTYPE_ELEMENT;
1009
+ };
829
1010
 
830
- revokeAll() {
831
- this.listeners.splice(0);
1011
+ var isRenderFunction = function isRenderFunction(c) {
1012
+ return (c == null ? void 0 : c.vtype) === VTYPE_FUNCTION;
1013
+ };
1014
+
1015
+ function jsx(type, props) {
1016
+ var vtype;
1017
+ if (typeof type === 'string') vtype = VTYPE_ELEMENT;else if (typeof type === 'function') vtype = VTYPE_FUNCTION;else throw new Error('Invalid VNode type');
1018
+ return {
1019
+ vtype: vtype,
1020
+ type: type,
1021
+ props: props
1022
+ };
1023
+ }
1024
+
1025
+ function Fragment(props) {
1026
+ return props.children;
1027
+ }
1028
+
1029
+ var DEFAULT_ENV = {
1030
+ isSvg: false
1031
+ };
1032
+
1033
+ function insertDom(parent, ref) {
1034
+ if (ref.type === MOUNT_SINGLE) {
1035
+ if (ref.node != null) parent.append(ref.node);
1036
+ } else if (ref.type === MOUNT_ARRAY) {
1037
+ ref.children.forEach(function (ch) {
1038
+ insertDom(parent, ch);
1039
+ });
1040
+ } else {
1041
+ throw new Error("Unkown ref type " + JSON.stringify(ref));
832
1042
  }
1043
+ }
833
1044
 
834
- call(...args) {
835
- for (const fn of this.listeners) {
836
- fn(...args);
1045
+ function mountAttributes(domElement, props, env) {
1046
+ for (var key in props) {
1047
+ if (key === 'key' || key === 'children' || key === 'ref') continue;
1048
+
1049
+ if (key === 'dangerouslySetInnerHTML') {
1050
+ domElement.innerHTML = props[key].__html;
1051
+ } else if (key === 'innerHTML' || key === 'textContent' || key === 'innerText') {
1052
+ domElement[key] = props[key];
1053
+ } else if (key.startsWith('on')) {
1054
+ domElement[key.toLowerCase()] = props[key];
1055
+ } else {
1056
+ setDOMAttribute(domElement, key, props[key], env.isSvg);
837
1057
  }
838
1058
  }
839
-
840
1059
  }
841
1060
 
842
- function _extends() {
843
- _extends = Object.assign || function (target) {
844
- for (var i = 1; i < arguments.length; i++) {
845
- var source = arguments[i];
1061
+ var attrMap = {
1062
+ className: 'class',
1063
+ labelFor: 'for'
1064
+ };
846
1065
 
847
- for (var key in source) {
848
- if (Object.prototype.hasOwnProperty.call(source, key)) {
849
- target[key] = source[key];
850
- }
851
- }
852
- }
1066
+ function setDOMAttribute(el, attr, value, isSVG) {
1067
+ attr = attrMap[attr] || attr;
853
1068
 
854
- return target;
855
- };
1069
+ if (value === true) {
1070
+ el.setAttribute(attr, '');
1071
+ } else if (value === false) {
1072
+ el.removeAttribute(attr);
1073
+ } else {
1074
+ var namespace = isSVG ? NS_ATTRS[attr] : undefined;
856
1075
 
857
- return _extends.apply(this, arguments);
1076
+ if (namespace !== undefined) {
1077
+ el.setAttributeNS(namespace, attr, value);
1078
+ } else {
1079
+ el.setAttribute(attr, value);
1080
+ }
1081
+ }
858
1082
  }
859
1083
 
860
- const uniqId = Math.random().toString(36).slice(2, 8);
861
- let globalIndex = 0;
1084
+ function mount(vnode, env) {
1085
+ if (env === void 0) {
1086
+ env = DEFAULT_ENV;
1087
+ }
862
1088
 
863
- function getId() {
864
- globalIndex += 1;
865
- return `mm-${uniqId}-${globalIndex}`;
866
- }
1089
+ if (vnode == null || typeof vnode === 'boolean') {
1090
+ return {
1091
+ type: MOUNT_SINGLE,
1092
+ node: null
1093
+ };
1094
+ }
867
1095
 
868
- function noop() {// noop
869
- }
1096
+ if (vnode instanceof Node) {
1097
+ return {
1098
+ type: MOUNT_SINGLE,
1099
+ node: vnode
1100
+ };
1101
+ }
870
1102
 
871
- function walkTree(tree, callback, key = 'c') {
872
- const walk = (item, parent) => callback(item, () => {
873
- var _item$key;
1103
+ if (isRenderFunction(vnode)) {
1104
+ var _ref = vnode,
1105
+ type = _ref.type,
1106
+ props = _ref.props;
874
1107
 
875
- (_item$key = item[key]) == null ? void 0 : _item$key.forEach(child => {
876
- walk(child, item);
877
- });
878
- }, parent);
1108
+ if (type === Fragment) {
1109
+ var node = document.createDocumentFragment();
879
1110
 
880
- walk(tree);
881
- }
1111
+ if (props.children) {
1112
+ var childrenRef = mount(props.children, env);
1113
+ insertDom(node, childrenRef);
1114
+ }
882
1115
 
883
- function arrayFrom(arrayLike) {
884
- if (Array.from) return Array.from(arrayLike);
885
- const array = [];
1116
+ return {
1117
+ type: MOUNT_SINGLE,
1118
+ node: node
1119
+ };
1120
+ }
886
1121
 
887
- for (let i = 0; i < arrayLike.length; i += 1) {
888
- array.push(arrayLike[i]);
1122
+ var childVNode = type(props);
1123
+ return mount(childVNode, env);
889
1124
  }
890
1125
 
891
- return array;
892
- }
1126
+ if (isLeaf(vnode)) {
1127
+ return {
1128
+ type: MOUNT_SINGLE,
1129
+ node: document.createTextNode("" + vnode)
1130
+ };
1131
+ }
893
1132
 
894
- function addClass(className, ...rest) {
895
- const classList = (className || '').split(' ').filter(Boolean);
896
- rest.forEach(item => {
897
- if (item && classList.indexOf(item) < 0) classList.push(item);
898
- });
899
- return classList.join(' ');
900
- }
1133
+ if (isElement(vnode)) {
1134
+ var _node;
901
1135
 
902
- function childSelector(filter) {
903
- if (typeof filter === 'string') {
904
- const tagName = filter;
1136
+ var _ref2 = vnode,
1137
+ _type = _ref2.type,
1138
+ _props = _ref2.props;
905
1139
 
906
- filter = el => el.tagName === tagName;
907
- }
1140
+ if (!env.isSvg && _type === 'svg') {
1141
+ env = Object.assign({}, env, {
1142
+ isSvg: true
1143
+ });
1144
+ }
908
1145
 
909
- const filterFn = filter;
910
- return function selector() {
911
- let nodes = arrayFrom(this.childNodes);
912
- if (filterFn) nodes = nodes.filter(node => filterFn(node));
913
- return nodes;
914
- };
915
- }
1146
+ if (!env.isSvg) {
1147
+ _node = document.createElement(_type);
1148
+ } else {
1149
+ _node = document.createElementNS(SVG_NS, _type);
1150
+ }
916
1151
 
917
- function memoize(fn) {
918
- const cache = {};
919
- return function memoized(...args) {
920
- const key = `${args[0]}`;
921
- let data = cache[key];
1152
+ mountAttributes(_node, _props, env);
922
1153
 
923
- if (!data) {
924
- data = {
925
- value: fn(...args)
926
- };
927
- cache[key] = data;
928
- }
1154
+ var _childrenRef;
929
1155
 
930
- return data.value;
931
- };
932
- }
1156
+ if (_props.children) {
1157
+ var childEnv = env;
933
1158
 
934
- function createElement(tagName, props, attrs) {
935
- const el = document.createElement(tagName);
1159
+ if (env.isSvg && _type === 'foreignObject') {
1160
+ childEnv = Object.assign({}, childEnv, {
1161
+ isSvg: false
1162
+ });
1163
+ }
936
1164
 
937
- if (props) {
938
- Object.entries(props).forEach(([key, value]) => {
939
- el[key] = value;
940
- });
1165
+ _childrenRef = mount(_props.children, childEnv);
1166
+ }
1167
+
1168
+ if (_childrenRef != null) insertDom(_node, _childrenRef);
1169
+ var ref = _props.ref;
1170
+ if (typeof ref === 'function') ref(_node);
1171
+ return {
1172
+ type: MOUNT_SINGLE,
1173
+ node: _node
1174
+ };
941
1175
  }
942
1176
 
943
- if (attrs) {
944
- Object.entries(attrs).forEach(([key, value]) => {
945
- el.setAttribute(key, value);
946
- });
1177
+ if (Array.isArray(vnode)) {
1178
+ return {
1179
+ type: MOUNT_ARRAY,
1180
+ children: vnode.map(function (child) {
1181
+ return mount(child, env);
1182
+ })
1183
+ };
947
1184
  }
948
1185
 
949
- return el;
1186
+ throw new Error('mount: Invalid Vnode!');
950
1187
  }
951
1188
 
952
- const memoizedPreloadJS = memoize(url => {
953
- document.head.append(createElement('link', {
954
- rel: 'preload',
955
- as: 'script',
956
- href: url
957
- }));
958
- });
959
-
960
- function loadJSItem(item, context) {
961
- if (item.type === 'script') {
962
- return new Promise((resolve, reject) => {
963
- var _item$data;
964
-
965
- document.head.append(createElement('script', _extends({}, item.data, {
966
- onload: resolve,
967
- onerror: reject
968
- }))); // Run inline script synchronously
1189
+ function flattenWithoutNull(array) {
1190
+ var result = [];
969
1191
 
970
- if (!((_item$data = item.data) != null && _item$data.src)) resolve();
971
- });
1192
+ for (var i = 0; i < array.length; i += 1) {
1193
+ var item = array[i];
1194
+ if (Array.isArray(item)) result = result.concat(flattenWithoutNull(item));else if (item != null) result.push(item);
972
1195
  }
973
1196
 
974
- if (item.type === 'iife') {
975
- const {
976
- fn,
977
- getParams
978
- } = item.data;
979
- fn(...((getParams == null ? void 0 : getParams(context)) || []));
980
- }
1197
+ return result;
981
1198
  }
982
1199
 
983
- function loadCSSItem(item) {
984
- if (item.type === 'style') {
985
- document.head.append(createElement('style', {
986
- textContent: item.data
987
- }));
988
- } else if (item.type === 'stylesheet') {
989
- document.head.append(createElement('link', _extends({
990
- rel: 'stylesheet'
991
- }, item.data)));
1200
+ function asDom(result) {
1201
+ if (result.type === MOUNT_SINGLE) {
1202
+ return result.node;
992
1203
  }
993
- }
994
1204
 
995
- async function loadJS(items, context) {
996
- const needPreload = items.filter(item => {
997
- var _item$data2;
1205
+ return result.children.map(asDom);
1206
+ }
1207
+ /**
1208
+ * Mount vdom as real DOM nodes.
1209
+ */
998
1210
 
999
- return item.type === 'script' && ((_item$data2 = item.data) == null ? void 0 : _item$data2.src);
1000
- });
1001
- if (needPreload.length > 1) needPreload.forEach(item => memoizedPreloadJS(item.data.src));
1002
- context = _extends({
1003
- getMarkmap: () => window.markmap
1004
- }, context);
1005
1211
 
1006
- for (const item of items) {
1007
- await loadJSItem(item, context);
1212
+ function mountDom(vnode) {
1213
+ if (Array.isArray(vnode)) {
1214
+ return flattenWithoutNull(vnode.map(mountDom));
1008
1215
  }
1009
- }
1010
1216
 
1011
- function loadCSS(items) {
1012
- for (const item of items) {
1013
- loadCSSItem(item);
1014
- }
1217
+ return asDom(mount(vnode));
1015
1218
  }
1016
1219
 
1220
+ var css_248z$1 = ".markmap{font:300 16px/20px sans-serif}.markmap-link{fill:none}.markmap-node>circle{cursor:pointer}.markmap-foreign{display:inline-block}.markmap-foreign a{color:#0097e6}.markmap-foreign a:hover{color:#00a8ff}.markmap-foreign code{background-color:#f0f0f0;border-radius:2px;color:#555;font-size:calc(1em - 2px)}.markmap-foreign :not(pre)>code{padding:.2em .4em}.markmap-foreign del{text-decoration:line-through}.markmap-foreign em{font-style:italic}.markmap-foreign strong{font-weight:bolder}.markmap-foreign mark{background:#ffeaa7}.markmap-foreign pre,.markmap-foreign pre[class*=language-]{margin:0;padding:.2em .4em}";
1221
+
1222
+ var css_248z = ".markmap-container{height:0;left:-100px;overflow:hidden;position:absolute;top:-100px;width:0}.markmap-container>*{display:inline-block}.markmap-container>*>.markmap-foreign:last-child{white-space:nowrap}";
1223
+
1224
+ const globalCSS = css_248z$1;
1225
+
1017
1226
  function linkWidth(nodeData) {
1018
1227
  const data = nodeData.data;
1019
- return Math.max(6 - 2 * data.d, 1.5);
1228
+ return Math.max(6 - 2 * data.depth, 1.5);
1020
1229
  }
1021
1230
 
1022
1231
  function adjustSpacing(tree, spacing) {
@@ -1047,30 +1256,32 @@ function createViewHooks() {
1047
1256
 
1048
1257
 
1049
1258
  const refreshHook = new Hook();
1259
+ const defaultColorFn = d3__namespace.scaleOrdinal(d3__namespace.schemeCategory10);
1260
+ const isMacintosh = typeof navigator !== 'undefined' && navigator.userAgent.includes('Macintosh');
1050
1261
  class Markmap {
1051
1262
  constructor(svg, opts) {
1052
- this.options = void 0;
1053
- this.state = void 0;
1054
- this.svg = void 0;
1055
- this.styleNode = void 0;
1056
- this.g = void 0;
1057
- this.zoom = void 0;
1058
- this.viewHooks = void 0;
1059
1263
  this.revokers = [];
1060
- ['handleZoom', 'handleClick'].forEach(key => {
1264
+ ['handleZoom', 'handleClick', 'handlePan'].forEach(key => {
1061
1265
  this[key] = this[key].bind(this);
1062
1266
  });
1063
1267
  this.viewHooks = createViewHooks();
1064
1268
  this.svg = svg.datum ? svg : d3__namespace.select(svg);
1065
1269
  this.styleNode = this.svg.append('style');
1066
- this.zoom = d3__namespace.zoom().on('zoom', this.handleZoom);
1067
- this.options = _extends$1({}, Markmap.defaultOptions, opts);
1270
+ this.zoom = d3__namespace.zoom().filter(event => {
1271
+ if (this.options.scrollForPan) {
1272
+ // Pan with wheels, zoom with ctrl+wheels
1273
+ if (event.type === 'wheel') return event.ctrlKey && !event.button;
1274
+ }
1275
+
1276
+ return (!event.ctrlKey || event.type === 'wheel') && !event.button;
1277
+ }).on('zoom', this.handleZoom);
1278
+ this.setOptions(opts);
1068
1279
  this.state = {
1069
- id: this.options.id || getId()
1280
+ id: this.options.id || this.svg.attr('id') || getId()
1070
1281
  };
1071
- this.g = this.svg.append('g').attr('class', `${this.state.id}-g`);
1282
+ this.g = this.svg.append('g');
1072
1283
  this.updateStyle();
1073
- this.svg.call(this.zoom);
1284
+ this.svg.call(this.zoom).on('wheel', this.handlePan);
1074
1285
  this.revokers.push(refreshHook.tap(() => {
1075
1286
  this.setData();
1076
1287
  }));
@@ -1078,34 +1289,19 @@ class Markmap {
1078
1289
 
1079
1290
  getStyleContent() {
1080
1291
  const {
1081
- style,
1082
- nodeFont
1292
+ style
1083
1293
  } = this.options;
1084
1294
  const {
1085
1295
  id
1086
1296
  } = this.state;
1087
- const extraStyle = typeof style === 'function' ? style(id) : '';
1088
- const styleText = `\
1089
- .${id} { line-height: 1; }
1090
- .${id} a { color: #0097e6; }
1091
- .${id} a:hover { color: #00a8ff; }
1092
- .${id}-g > path { fill: none; }
1093
- .${id}-g > g > circle { cursor: pointer; }
1094
- .${id}-fo > div { display: inline-block; font: ${nodeFont}; white-space: nowrap; }
1095
- .${id}-fo code { font-size: calc(1em - 2px); color: #555; background-color: #f0f0f0; border-radius: 2px; }
1096
- .${id}-fo :not(pre) > code { padding: .2em .4em; }
1097
- .${id}-fo del { text-decoration: line-through; }
1098
- .${id}-fo em { font-style: italic; }
1099
- .${id}-fo strong { font-weight: bolder; }
1100
- .${id}-fo pre { margin: 0; padding: .2em .4em; }
1101
- ${extraStyle}
1102
- `;
1103
- return styleText;
1297
+ const styleText = typeof style === 'function' ? style(id) : '';
1298
+ return [this.options.embedGlobalCSS && css_248z$1, styleText].filter(Boolean).join('\n');
1104
1299
  }
1105
1300
 
1106
1301
  updateStyle() {
1107
- this.svg.attr('class', addClass(this.svg.attr('class'), this.state.id));
1108
- this.styleNode.text(this.getStyleContent());
1302
+ this.svg.attr('class', addClass(this.svg.attr('class'), 'markmap', this.state.id));
1303
+ const style = this.getStyleContent();
1304
+ this.styleNode.text(style);
1109
1305
  }
1110
1306
 
1111
1307
  handleZoom(e) {
@@ -1115,76 +1311,84 @@ ${extraStyle}
1115
1311
  this.g.attr('transform', transform);
1116
1312
  }
1117
1313
 
1118
- handleClick(e, d) {
1119
- var _data$p;
1314
+ handlePan(e) {
1315
+ e.preventDefault();
1316
+ const transform = d3__namespace.zoomTransform(this.svg.node());
1317
+ const newTransform = transform.translate(-e.deltaX, -e.deltaY);
1318
+ this.svg.call(this.zoom.transform, newTransform);
1319
+ }
1320
+
1321
+ handleClick(_, d) {
1322
+ var _data$payload;
1120
1323
 
1121
1324
  const {
1122
1325
  data
1123
1326
  } = d;
1124
- data.p = _extends$1({}, data.p, {
1125
- f: !((_data$p = data.p) != null && _data$p.f)
1327
+ data.payload = _extends({}, data.payload, {
1328
+ fold: !((_data$payload = data.payload) != null && _data$payload.fold)
1126
1329
  });
1127
1330
  this.renderData(d.data);
1128
1331
  }
1129
1332
 
1130
1333
  initializeData(node) {
1131
- let i = 0;
1334
+ let nodeId = 0;
1132
1335
  const {
1133
- nodeFont,
1134
1336
  color,
1135
- nodeMinHeight
1337
+ nodeMinHeight,
1338
+ maxWidth
1136
1339
  } = this.options;
1137
1340
  const {
1138
1341
  id
1139
1342
  } = this.state;
1140
- const container = document.createElement('div');
1141
- const containerClass = `${id}-container`;
1142
- container.className = addClass(container.className, `${id}-fo`, containerClass);
1143
- const style = document.createElement('style');
1144
- style.textContent = `
1145
- ${this.getStyleContent()}
1146
- .${containerClass} {
1147
- position: absolute;
1148
- width: 0;
1149
- height: 0;
1150
- top: -100px;
1151
- left: -100px;
1152
- overflow: hidden;
1153
- font: ${nodeFont};
1154
- }
1155
- .${containerClass} > div {
1156
- display: inline-block;
1157
- }
1158
- `;
1159
- document.body.append(style, container);
1343
+ const container = mountDom(jsx("div", {
1344
+ className: `markmap-container markmap ${id}-g`
1345
+ }));
1346
+ const style = mountDom(jsx("style", {
1347
+ children: [this.getStyleContent(), css_248z].join('\n')
1348
+ }));
1349
+ document.body.append(container, style);
1350
+ const groupStyle = maxWidth ? `max-width: ${maxWidth}px` : null;
1160
1351
  walkTree(node, (item, next) => {
1161
- var _item$c;
1162
-
1163
- item.c = (_item$c = item.c) == null ? void 0 : _item$c.map(child => _extends$1({}, child));
1164
- i += 1;
1165
- const el = document.createElement('div');
1166
- el.innerHTML = item.v;
1167
- container.append(el);
1168
- item.p = _extends$1({}, item.p, {
1169
- // unique ID
1170
- i,
1171
- el
1352
+ var _item$children;
1353
+
1354
+ item.children = (_item$children = item.children) == null ? void 0 : _item$children.map(child => _extends({}, child));
1355
+ nodeId += 1;
1356
+ const group = mountDom(jsx("div", {
1357
+ style: groupStyle,
1358
+ children: jsx("div", {
1359
+ className: "markmap-foreign",
1360
+ dangerouslySetInnerHTML: {
1361
+ __html: item.content
1362
+ }
1363
+ })
1364
+ }));
1365
+ container.append(group);
1366
+ item.state = _extends({}, item.state, {
1367
+ id: nodeId,
1368
+ el: group.firstChild
1172
1369
  });
1173
1370
  color(item); // preload colors
1174
1371
 
1175
1372
  next();
1176
1373
  });
1177
- const nodes = arrayFrom(container.childNodes);
1178
- this.viewHooks.transformHtml.call(this, nodes);
1374
+ const nodes = arrayFrom(container.childNodes).map(group => group.firstChild);
1375
+ this.viewHooks.transformHtml.call(this, nodes); // Clone the rendered HTML and set `white-space: nowrap` to it to detect its max-width.
1376
+ // The parent node will have a width of the max-width and the original content without
1377
+ // `white-space: nowrap` gets re-layouted, then we will get the expected layout, with
1378
+ // content in one line as much as possible, and subjecting to the given max-width.
1379
+
1380
+ nodes.forEach(node => {
1381
+ node.parentNode.append(node.cloneNode(true));
1382
+ });
1179
1383
  walkTree(node, (item, next, parent) => {
1180
- var _parent$p;
1181
-
1182
- const rect = item.p.el.getBoundingClientRect();
1183
- item.v = item.p.el.innerHTML;
1184
- item.p.s = [Math.ceil(rect.width), Math.max(Math.ceil(rect.height), nodeMinHeight)]; // TODO keep keys for unchanged objects
1185
- // unique key, should be based on content
1186
-
1187
- item.p.k = `${(parent == null ? void 0 : (_parent$p = parent.p) == null ? void 0 : _parent$p.i) || ''}.${item.p.i}:${item.v}`;
1384
+ var _parent$state, _parent$state2;
1385
+
1386
+ const rect = item.state.el.getBoundingClientRect();
1387
+ item.content = item.state.el.innerHTML;
1388
+ item.state.size = [Math.ceil(rect.width) + 1, Math.max(Math.ceil(rect.height), nodeMinHeight)];
1389
+ item.state.path = [parent == null ? void 0 : (_parent$state = parent.state) == null ? void 0 : _parent$state.path, item.state.id].filter(Boolean).join('.');
1390
+ item.state.key = [parent == null ? void 0 : (_parent$state2 = parent.state) == null ? void 0 : _parent$state2.id, item.state.id].filter(Boolean).join('.') + // FIXME: find a way to check content hash
1391
+ item.content;
1188
1392
  next();
1189
1393
  });
1190
1394
  container.remove();
@@ -1192,19 +1396,18 @@ ${this.getStyleContent()}
1192
1396
  }
1193
1397
 
1194
1398
  setOptions(opts) {
1195
- Object.assign(this.options, opts);
1399
+ this.options = _extends({}, Markmap.defaultOptions, opts);
1196
1400
  }
1197
1401
 
1198
1402
  setData(data, opts) {
1199
- if (!data) data = _extends$1({}, this.state.data);
1200
- this.state.data = data;
1201
- this.initializeData(data);
1403
+ if (data) this.state.data = data;
1404
+ this.initializeData(this.state.data);
1202
1405
  if (opts) this.setOptions(opts);
1203
1406
  this.renderData();
1204
1407
  }
1205
1408
 
1206
1409
  renderData(originData) {
1207
- var _origin$data$p$x, _origin$data$p$y;
1410
+ var _origin$data$state$x, _origin$data$state$y;
1208
1411
 
1209
1412
  if (!this.state.data) return;
1210
1413
  const {
@@ -1214,15 +1417,12 @@ ${this.getStyleContent()}
1214
1417
  autoFit,
1215
1418
  color
1216
1419
  } = this.options;
1217
- const {
1218
- id
1219
- } = this.state;
1220
1420
  const layout = flextree().children(d => {
1221
- var _d$p;
1421
+ var _d$payload;
1222
1422
 
1223
- return !((_d$p = d.p) != null && _d$p.f) && d.c;
1423
+ return !((_d$payload = d.payload) != null && _d$payload.fold) && d.children;
1224
1424
  }).nodeSize(d => {
1225
- const [width, height] = d.data.p.s;
1425
+ const [width, height] = d.data.state.size;
1226
1426
  return [height, width + (width ? paddingX * 2 : 0) + spacingHorizontal];
1227
1427
  }).spacing((a, b) => {
1228
1428
  return a.parent === b.parent ? spacingVertical : spacingVertical * 2;
@@ -1245,43 +1445,45 @@ ${this.getStyleContent()}
1245
1445
  });
1246
1446
  if (autoFit) this.fit();
1247
1447
  const origin = originData && descendants.find(item => item.data === originData) || tree;
1248
- const x0 = (_origin$data$p$x = origin.data.p.x0) != null ? _origin$data$p$x : origin.x;
1249
- const y0 = (_origin$data$p$y = origin.data.p.y0) != null ? _origin$data$p$y : origin.y; // Update the nodes
1448
+ const x0 = (_origin$data$state$x = origin.data.state.x0) != null ? _origin$data$state$x : origin.x;
1449
+ const y0 = (_origin$data$state$y = origin.data.state.y0) != null ? _origin$data$state$y : origin.y; // Update the nodes
1250
1450
 
1251
- const node = this.g.selectAll(childSelector('g')).data(descendants, d => d.data.p.k);
1252
- const nodeEnter = node.enter().append('g').attr('transform', d => `translate(${y0 + origin.ySizeInner - d.ySizeInner},${x0 + origin.xSize / 2 - d.xSize})`);
1451
+ const node = this.g.selectAll(childSelector('g')).data(descendants, d => d.data.state.key);
1452
+ const nodeEnter = node.enter().append('g').attr('class', 'markmap-node').attr('data-depth', d => d.data.depth).attr('data-path', d => d.data.state.path).attr('transform', d => `translate(${y0 + origin.ySizeInner - d.ySizeInner},${x0 + origin.xSize / 2 - d.xSize})`);
1253
1453
  const nodeExit = this.transition(node.exit());
1254
- nodeExit.select('rect').attr('width', 0).attr('x', d => d.ySizeInner);
1454
+ nodeExit.select('line').attr('x1', d => d.ySizeInner).attr('x2', d => d.ySizeInner);
1255
1455
  nodeExit.select('foreignObject').style('opacity', 0);
1256
1456
  nodeExit.attr('transform', d => `translate(${origin.y + origin.ySizeInner - d.ySizeInner},${origin.x + origin.xSize / 2 - d.xSize})`).remove();
1257
1457
  const nodeMerge = node.merge(nodeEnter);
1258
- this.transition(nodeMerge).attr('transform', d => `translate(${d.y},${d.x - d.xSize / 2})`);
1259
- const rect = nodeMerge.selectAll(childSelector('rect')).data(d => [d], d => d.data.p.k).join(enter => {
1260
- return enter.append('rect').attr('x', d => d.ySizeInner).attr('y', d => d.xSize - linkWidth(d) / 2).attr('width', 0).attr('height', linkWidth);
1458
+ this.transition(nodeMerge).attr('transform', d => `translate(${d.y},${d.x - d.xSize / 2})`); // Update lines under the content
1459
+
1460
+ const line = nodeMerge.selectAll(childSelector('line')).data(d => [d], d => d.data.state.key).join(enter => {
1461
+ return enter.append('line').attr('x1', d => d.ySizeInner).attr('y1', d => d.xSize).attr('x2', d => d.ySizeInner).attr('y2', d => d.xSize);
1261
1462
  }, update => update, exit => exit.remove());
1262
- this.transition(rect).attr('x', -1).attr('width', d => d.ySizeInner + 2).attr('fill', d => color(d.data));
1263
- const circle = nodeMerge.selectAll(childSelector('circle')).data(d => d.data.c ? [d] : [], d => d.data.p.k).join(enter => {
1463
+ this.transition(line).attr('x1', -1).attr('x2', d => d.ySizeInner + 2).attr('stroke', d => color(d.data)).attr('stroke-width', linkWidth); // Circle to link to children of the node
1464
+
1465
+ const circle = nodeMerge.selectAll(childSelector('circle')).data(d => d.data.children ? [d] : [], d => d.data.state.key).join(enter => {
1264
1466
  return enter.append('circle').attr('stroke-width', '1.5').attr('cx', d => d.ySizeInner).attr('cy', d => d.xSize).attr('r', 0).on('click', this.handleClick);
1265
1467
  }, update => update, exit => exit.remove());
1266
1468
  this.transition(circle).attr('r', 6).attr('stroke', d => color(d.data)).attr('fill', d => {
1267
- var _d$data$p;
1469
+ var _d$data$payload;
1268
1470
 
1269
- return (_d$data$p = d.data.p) != null && _d$data$p.f && d.data.c ? color(d.data) : '#fff';
1471
+ return (_d$data$payload = d.data.payload) != null && _d$data$payload.fold && d.data.children ? color(d.data) : '#fff';
1270
1472
  });
1271
- const foreignObject = nodeMerge.selectAll(childSelector('foreignObject')).data(d => [d], d => d.data.p.k).join(enter => {
1272
- const fo = enter.append('foreignObject').attr('class', `${id}-fo`).attr('x', paddingX).attr('y', 0).style('opacity', 0).attr('height', d => d.xSize).on('mousedown', stopPropagation).on('dblclick', stopPropagation);
1473
+ const foreignObject = nodeMerge.selectAll(childSelector('foreignObject')).data(d => [d], d => d.data.state.key).join(enter => {
1474
+ const fo = enter.append('foreignObject').attr('class', 'markmap-foreign').attr('x', paddingX).attr('y', 0).style('opacity', 0).attr('height', d => d.xSize).on('mousedown', stopPropagation).on('dblclick', stopPropagation);
1273
1475
  fo.append('xhtml:div').select(function select(d) {
1274
- const node = d.data.p.el.cloneNode(true);
1275
- this.replaceWith(node);
1276
- return node;
1476
+ const clone = d.data.state.el.cloneNode(true);
1477
+ this.replaceWith(clone);
1478
+ return clone;
1277
1479
  }).attr('xmlns', 'http://www.w3.org/1999/xhtml');
1278
1480
  return fo;
1279
1481
  }, update => update, exit => exit.remove()).attr('width', d => Math.max(0, d.ySizeInner - paddingX * 2));
1280
1482
  this.transition(foreignObject).style('opacity', 1); // Update the links
1281
1483
 
1282
- const path = this.g.selectAll(childSelector('path')).data(links, d => d.target.data.p.k).join(enter => {
1484
+ const path = this.g.selectAll(childSelector('path')).data(links, d => d.target.data.state.key).join(enter => {
1283
1485
  const source = [y0 + origin.ySizeInner, x0 + origin.xSize / 2];
1284
- return enter.insert('path', 'g').attr('d', linkShape({
1486
+ return enter.insert('path', 'g').attr('class', 'markmap-link').attr('data-depth', d => d.target.data.depth).attr('data-path', d => d.target.data.state.path).attr('d', linkShape({
1285
1487
  source,
1286
1488
  target: source
1287
1489
  }));
@@ -1301,8 +1503,8 @@ ${this.getStyleContent()}
1301
1503
  });
1302
1504
  });
1303
1505
  descendants.forEach(d => {
1304
- d.data.p.x0 = d.x;
1305
- d.data.p.y0 = d.y;
1506
+ d.data.state.x0 = d.x;
1507
+ d.data.state.y0 = d.y;
1306
1508
  });
1307
1509
  }
1308
1510
 
@@ -1359,7 +1561,7 @@ ${this.getStyleContent()}
1359
1561
  const [left, right] = [itemData.y, itemData.y + itemData.ySizeInner + 2].map(x => x * transform.k + transform.x);
1360
1562
  const [top, bottom] = [itemData.x - itemData.xSize / 2, itemData.x + itemData.xSize / 2].map(y => y * transform.k + transform.y); // Skip if the node includes or is included in the container.
1361
1563
 
1362
- const pd = _extends$1({
1564
+ const pd = _extends({
1363
1565
  left: 0,
1364
1566
  right: 0,
1365
1567
  top: 0,
@@ -1395,7 +1597,8 @@ ${this.getStyleContent()}
1395
1597
  }
1396
1598
 
1397
1599
  destroy() {
1398
- this.svg.remove();
1600
+ this.svg.on('.zoom', null);
1601
+ this.svg.html(null);
1399
1602
  this.revokers.forEach(fn => {
1400
1603
  fn();
1401
1604
  });
@@ -1414,20 +1617,57 @@ ${this.getStyleContent()}
1414
1617
 
1415
1618
  }
1416
1619
  Markmap.defaultOptions = {
1620
+ autoFit: false,
1621
+ color: node => defaultColorFn(`${node.state.id}`),
1417
1622
  duration: 500,
1418
- nodeFont: '300 16px/20px sans-serif',
1623
+ embedGlobalCSS: true,
1624
+ fitRatio: 0.95,
1625
+ maxWidth: 0,
1419
1626
  nodeMinHeight: 16,
1420
- spacingVertical: 5,
1627
+ paddingX: 8,
1628
+ scrollForPan: isMacintosh,
1421
1629
  spacingHorizontal: 80,
1422
- autoFit: false,
1423
- fitRatio: 0.95,
1424
- color: (colorFn => node => colorFn(node.p.i))(d3__namespace.scaleOrdinal(d3__namespace.schemeCategory10)),
1425
- paddingX: 8
1630
+ spacingVertical: 5
1426
1631
  };
1632
+ function deriveOptions(jsonOptions) {
1633
+ const {
1634
+ color,
1635
+ duration,
1636
+ maxWidth
1637
+ } = jsonOptions || {};
1638
+ let opts;
1639
+
1640
+ if (typeof color === 'string') {
1641
+ opts = _extends({}, opts, {
1642
+ color: () => color
1643
+ });
1644
+ } else if (color != null && color.length) {
1645
+ opts = _extends({}, opts, {
1646
+ color: node => color[node.state.id % color.length]
1647
+ });
1648
+ }
1649
+
1650
+ if (typeof duration === 'number') {
1651
+ opts = _extends({}, opts, {
1652
+ duration
1653
+ });
1654
+ }
1655
+
1656
+ if (typeof maxWidth === 'number') {
1657
+ opts = _extends({}, opts, {
1658
+ maxWidth
1659
+ });
1660
+ }
1661
+
1662
+ return opts;
1663
+ }
1427
1664
 
1428
1665
  exports.Markmap = Markmap;
1666
+ exports.defaultColorFn = defaultColorFn;
1667
+ exports.deriveOptions = deriveOptions;
1668
+ exports.globalCSS = globalCSS;
1429
1669
  exports.loadCSS = loadCSS;
1430
1670
  exports.loadJS = loadJS;
1431
1671
  exports.refreshHook = refreshHook;
1432
1672
 
1433
- }(this.markmap = this.markmap || {}, d3));
1673
+ })(this.markmap = this.markmap || {}, d3);