markmap-view 0.15.5 → 0.15.6-alpha.4
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/browser/index.js +4 -1670
- package/dist/index.js +743 -1123
- package/package.json +7 -9
- /package/{types → dist}/index.d.ts +0 -0
- /package/{types → dist}/types.d.ts +0 -0
- /package/{types → dist}/view.d.ts +0 -0
package/dist/browser/index.js
CHANGED
|
@@ -1,1670 +1,4 @@
|
|
|
1
|
-
/*! markmap-view v0.15.5 | MIT License */
|
|
2
|
-
(function (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/*! markmap-common v0.15.5 | MIT License */
|
|
6
|
-
function _extends$1() {
|
|
7
|
-
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
|
8
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
9
|
-
var source = arguments[i];
|
|
10
|
-
for (var key in source) {
|
|
11
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
12
|
-
target[key] = source[key];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return target;
|
|
17
|
-
};
|
|
18
|
-
return _extends$1.apply(this, arguments);
|
|
19
|
-
}
|
|
20
|
-
const testPath = "npm2url/dist/index.cjs";
|
|
21
|
-
const defaultProviders = {
|
|
22
|
-
jsdelivr: path => `https://cdn.jsdelivr.net/npm/${path}`,
|
|
23
|
-
unpkg: path => `https://unpkg.com/${path}`
|
|
24
|
-
};
|
|
25
|
-
class UrlBuilder {
|
|
26
|
-
constructor() {
|
|
27
|
-
this.providers = _extends$1({}, defaultProviders);
|
|
28
|
-
this.provider = "jsdelivr";
|
|
29
|
-
}
|
|
30
|
-
getFastestProvider(timeout = 5e3, path = testPath) {
|
|
31
|
-
return new Promise((resolve, reject) => {
|
|
32
|
-
Promise.all(Object.entries(this.providers).map(async ([name, factory]) => {
|
|
33
|
-
try {
|
|
34
|
-
const res = await fetch(factory(path));
|
|
35
|
-
if (!res.ok) {
|
|
36
|
-
throw res;
|
|
37
|
-
}
|
|
38
|
-
await res.text();
|
|
39
|
-
resolve(name);
|
|
40
|
-
} catch (_unused) {}
|
|
41
|
-
})).then(() => reject(new Error("All providers failed")));
|
|
42
|
-
setTimeout(reject, timeout, new Error("Timed out"));
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
async findFastestProvider(timeout) {
|
|
46
|
-
this.provider = await this.getFastestProvider(timeout);
|
|
47
|
-
return this.provider;
|
|
48
|
-
}
|
|
49
|
-
setProvider(name, factory) {
|
|
50
|
-
if (factory) {
|
|
51
|
-
this.providers[name] = factory;
|
|
52
|
-
} else {
|
|
53
|
-
delete this.providers[name];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
getFullUrl(path, provider = this.provider) {
|
|
57
|
-
if (path.includes("://")) {
|
|
58
|
-
return path;
|
|
59
|
-
}
|
|
60
|
-
const factory = this.providers[provider];
|
|
61
|
-
if (!factory) {
|
|
62
|
-
throw new Error(`Provider ${provider} not found`);
|
|
63
|
-
}
|
|
64
|
-
return factory(path);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
new UrlBuilder();
|
|
68
|
-
class Hook {
|
|
69
|
-
constructor() {
|
|
70
|
-
this.listeners = [];
|
|
71
|
-
}
|
|
72
|
-
tap(fn) {
|
|
73
|
-
this.listeners.push(fn);
|
|
74
|
-
return () => this.revoke(fn);
|
|
75
|
-
}
|
|
76
|
-
revoke(fn) {
|
|
77
|
-
const i = this.listeners.indexOf(fn);
|
|
78
|
-
if (i >= 0) this.listeners.splice(i, 1);
|
|
79
|
-
}
|
|
80
|
-
revokeAll() {
|
|
81
|
-
this.listeners.splice(0);
|
|
82
|
-
}
|
|
83
|
-
call(...args) {
|
|
84
|
-
for (const fn of this.listeners) {
|
|
85
|
-
fn(...args);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
const uniqId = Math.random().toString(36).slice(2, 8);
|
|
90
|
-
let globalIndex = 0;
|
|
91
|
-
function getId() {
|
|
92
|
-
globalIndex += 1;
|
|
93
|
-
return `mm-${uniqId}-${globalIndex}`;
|
|
94
|
-
}
|
|
95
|
-
function noop() {
|
|
96
|
-
// noop
|
|
97
|
-
}
|
|
98
|
-
function walkTree(tree, callback) {
|
|
99
|
-
const walk = (item, parent) => callback(item, () => {
|
|
100
|
-
var _item$children;
|
|
101
|
-
(_item$children = item.children) == null || _item$children.forEach(child => {
|
|
102
|
-
walk(child, item);
|
|
103
|
-
});
|
|
104
|
-
}, parent);
|
|
105
|
-
walk(tree);
|
|
106
|
-
}
|
|
107
|
-
function addClass(className, ...rest) {
|
|
108
|
-
const classList = (className || '').split(' ').filter(Boolean);
|
|
109
|
-
rest.forEach(item => {
|
|
110
|
-
if (item && classList.indexOf(item) < 0) classList.push(item);
|
|
111
|
-
});
|
|
112
|
-
return classList.join(' ');
|
|
113
|
-
}
|
|
114
|
-
function childSelector(filter) {
|
|
115
|
-
if (typeof filter === 'string') {
|
|
116
|
-
const tagName = filter;
|
|
117
|
-
filter = el => el.tagName === tagName;
|
|
118
|
-
}
|
|
119
|
-
const filterFn = filter;
|
|
120
|
-
return function selector() {
|
|
121
|
-
let nodes = Array.from(this.childNodes);
|
|
122
|
-
if (filterFn) nodes = nodes.filter(node => filterFn(node));
|
|
123
|
-
return nodes;
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function memoize(fn) {
|
|
127
|
-
const cache = {};
|
|
128
|
-
return function memoized(...args) {
|
|
129
|
-
const key = `${args[0]}`;
|
|
130
|
-
let data = cache[key];
|
|
131
|
-
if (!data) {
|
|
132
|
-
data = {
|
|
133
|
-
value: fn(...args)
|
|
134
|
-
};
|
|
135
|
-
cache[key] = data;
|
|
136
|
-
}
|
|
137
|
-
return data.value;
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/*! @gera2ld/jsx-dom v2.2.2 | ISC License */
|
|
142
|
-
const VTYPE_ELEMENT$1 = 1;
|
|
143
|
-
const VTYPE_FUNCTION$1 = 2;
|
|
144
|
-
const SVG_NS$1 = 'http://www.w3.org/2000/svg';
|
|
145
|
-
const XLINK_NS$1 = 'http://www.w3.org/1999/xlink';
|
|
146
|
-
const NS_ATTRS$1 = {
|
|
147
|
-
show: XLINK_NS$1,
|
|
148
|
-
actuate: XLINK_NS$1,
|
|
149
|
-
href: XLINK_NS$1
|
|
150
|
-
};
|
|
151
|
-
const isLeaf$1 = c => typeof c === 'string' || typeof c === 'number';
|
|
152
|
-
const isElement$1 = c => (c == null ? void 0 : c.vtype) === VTYPE_ELEMENT$1;
|
|
153
|
-
const isRenderFunction$1 = c => (c == null ? void 0 : c.vtype) === VTYPE_FUNCTION$1;
|
|
154
|
-
function h(type, props, ...children) {
|
|
155
|
-
props = Object.assign({}, props, {
|
|
156
|
-
children: children.length === 1 ? children[0] : children
|
|
157
|
-
});
|
|
158
|
-
return jsx$1(type, props);
|
|
159
|
-
}
|
|
160
|
-
function jsx$1(type, props) {
|
|
161
|
-
let vtype;
|
|
162
|
-
if (typeof type === 'string') vtype = VTYPE_ELEMENT$1;else if (typeof type === 'function') vtype = VTYPE_FUNCTION$1;else throw new Error('Invalid VNode type');
|
|
163
|
-
return {
|
|
164
|
-
vtype,
|
|
165
|
-
type,
|
|
166
|
-
props
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
function Fragment$1(props) {
|
|
170
|
-
return props.children;
|
|
171
|
-
}
|
|
172
|
-
const DEFAULT_ENV$1 = {
|
|
173
|
-
isSvg: false
|
|
174
|
-
};
|
|
175
|
-
function insertDom$1(parent, nodes) {
|
|
176
|
-
if (!Array.isArray(nodes)) nodes = [nodes];
|
|
177
|
-
nodes = nodes.filter(Boolean);
|
|
178
|
-
if (nodes.length) parent.append(...nodes);
|
|
179
|
-
}
|
|
180
|
-
function mountAttributes$1(domElement, props, env) {
|
|
181
|
-
for (const key in props) {
|
|
182
|
-
if (key === 'key' || key === 'children' || key === 'ref') continue;
|
|
183
|
-
if (key === 'dangerouslySetInnerHTML') {
|
|
184
|
-
domElement.innerHTML = props[key].__html;
|
|
185
|
-
} else if (key === 'innerHTML' || key === 'textContent' || key === 'innerText' || key === 'value' && ['textarea', 'select'].includes(domElement.tagName)) {
|
|
186
|
-
const value = props[key];
|
|
187
|
-
if (value != null) domElement[key] = value;
|
|
188
|
-
} else if (key.startsWith('on')) {
|
|
189
|
-
domElement[key.toLowerCase()] = props[key];
|
|
190
|
-
} else {
|
|
191
|
-
setDOMAttribute$1(domElement, key, props[key], env.isSvg);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
const attrMap$1 = {
|
|
196
|
-
className: 'class',
|
|
197
|
-
labelFor: 'for'
|
|
198
|
-
};
|
|
199
|
-
function setDOMAttribute$1(el, attr, value, isSVG) {
|
|
200
|
-
attr = attrMap$1[attr] || attr;
|
|
201
|
-
if (value === true) {
|
|
202
|
-
el.setAttribute(attr, '');
|
|
203
|
-
} else if (value === false) {
|
|
204
|
-
el.removeAttribute(attr);
|
|
205
|
-
} else {
|
|
206
|
-
const namespace = isSVG ? NS_ATTRS$1[attr] : undefined;
|
|
207
|
-
if (namespace !== undefined) {
|
|
208
|
-
el.setAttributeNS(namespace, attr, value);
|
|
209
|
-
} else {
|
|
210
|
-
el.setAttribute(attr, value);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
function flatten$1(arr) {
|
|
215
|
-
return arr.reduce((prev, item) => prev.concat(item), []);
|
|
216
|
-
}
|
|
217
|
-
function mountChildren$1(children, env) {
|
|
218
|
-
return Array.isArray(children) ? flatten$1(children.map(child => mountChildren$1(child, env))) : mount$1(children, env);
|
|
219
|
-
}
|
|
220
|
-
function mount$1(vnode, env = DEFAULT_ENV$1) {
|
|
221
|
-
if (vnode == null || typeof vnode === 'boolean') {
|
|
222
|
-
return null;
|
|
223
|
-
}
|
|
224
|
-
if (vnode instanceof Node) {
|
|
225
|
-
return vnode;
|
|
226
|
-
}
|
|
227
|
-
if (isRenderFunction$1(vnode)) {
|
|
228
|
-
const {
|
|
229
|
-
type,
|
|
230
|
-
props
|
|
231
|
-
} = vnode;
|
|
232
|
-
if (type === Fragment$1) {
|
|
233
|
-
const node = document.createDocumentFragment();
|
|
234
|
-
if (props.children) {
|
|
235
|
-
const children = mountChildren$1(props.children, env);
|
|
236
|
-
insertDom$1(node, children);
|
|
237
|
-
}
|
|
238
|
-
return node;
|
|
239
|
-
}
|
|
240
|
-
const childVNode = type(props);
|
|
241
|
-
return mount$1(childVNode, env);
|
|
242
|
-
}
|
|
243
|
-
if (isLeaf$1(vnode)) {
|
|
244
|
-
return document.createTextNode(`${vnode}`);
|
|
245
|
-
}
|
|
246
|
-
if (isElement$1(vnode)) {
|
|
247
|
-
let node;
|
|
248
|
-
const {
|
|
249
|
-
type,
|
|
250
|
-
props
|
|
251
|
-
} = vnode;
|
|
252
|
-
if (!env.isSvg && type === 'svg') {
|
|
253
|
-
env = Object.assign({}, env, {
|
|
254
|
-
isSvg: true
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
if (!env.isSvg) {
|
|
258
|
-
node = document.createElement(type);
|
|
259
|
-
} else {
|
|
260
|
-
node = document.createElementNS(SVG_NS$1, type);
|
|
261
|
-
}
|
|
262
|
-
mountAttributes$1(node, props, env);
|
|
263
|
-
if (props.children) {
|
|
264
|
-
let childEnv = env;
|
|
265
|
-
if (env.isSvg && type === 'foreignObject') {
|
|
266
|
-
childEnv = Object.assign({}, childEnv, {
|
|
267
|
-
isSvg: false
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
const children = mountChildren$1(props.children, childEnv);
|
|
271
|
-
if (children != null) insertDom$1(node, children);
|
|
272
|
-
}
|
|
273
|
-
const {
|
|
274
|
-
ref
|
|
275
|
-
} = props;
|
|
276
|
-
if (typeof ref === 'function') ref(node);
|
|
277
|
-
return node;
|
|
278
|
-
}
|
|
279
|
-
throw new Error('mount: Invalid Vnode!');
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Mount vdom as real DOM nodes.
|
|
284
|
-
*/
|
|
285
|
-
function mountDom$1(vnode) {
|
|
286
|
-
return mount$1(vnode);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Render and mount without returning VirtualDOM, useful when you don't need SVG support.
|
|
291
|
-
*/
|
|
292
|
-
function hm(...args) {
|
|
293
|
-
return mountDom$1(h(...args));
|
|
294
|
-
}
|
|
295
|
-
const memoizedPreloadJS = memoize(url => {
|
|
296
|
-
document.head.append(hm('link', {
|
|
297
|
-
rel: 'preload',
|
|
298
|
-
as: 'script',
|
|
299
|
-
href: url
|
|
300
|
-
}));
|
|
301
|
-
});
|
|
302
|
-
const jsCache = {};
|
|
303
|
-
const cssCache = {};
|
|
304
|
-
async function loadJSItem(item, context) {
|
|
305
|
-
var _item$data;
|
|
306
|
-
const src = item.type === 'script' && ((_item$data = item.data) == null ? void 0 : _item$data.src) || '';
|
|
307
|
-
item.loaded || (item.loaded = jsCache[src]);
|
|
308
|
-
if (!item.loaded) {
|
|
309
|
-
if (item.type === 'script') {
|
|
310
|
-
item.loaded = new Promise((resolve, reject) => {
|
|
311
|
-
document.head.append(hm('script', _extends$1({}, item.data, {
|
|
312
|
-
onLoad: resolve,
|
|
313
|
-
onError: reject
|
|
314
|
-
})));
|
|
315
|
-
if (!src) {
|
|
316
|
-
// Run inline script synchronously
|
|
317
|
-
resolve(undefined);
|
|
318
|
-
}
|
|
319
|
-
}).then(() => {
|
|
320
|
-
item.loaded = true;
|
|
321
|
-
});
|
|
322
|
-
if (src) jsCache[src] = item.loaded;
|
|
323
|
-
}
|
|
324
|
-
if (item.type === 'iife') {
|
|
325
|
-
const {
|
|
326
|
-
fn,
|
|
327
|
-
getParams
|
|
328
|
-
} = item.data;
|
|
329
|
-
fn(...((getParams == null ? void 0 : getParams(context)) || []));
|
|
330
|
-
item.loaded = true;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
await item.loaded;
|
|
334
|
-
}
|
|
335
|
-
function loadCSSItem(item) {
|
|
336
|
-
const url = item.type === 'stylesheet' && item.data.href || '';
|
|
337
|
-
item.loaded || (item.loaded = cssCache[url]);
|
|
338
|
-
if (item.loaded) return;
|
|
339
|
-
item.loaded = true;
|
|
340
|
-
if (url) cssCache[url] = true;
|
|
341
|
-
if (item.type === 'style') {
|
|
342
|
-
document.head.append(hm('style', {
|
|
343
|
-
textContent: item.data
|
|
344
|
-
}));
|
|
345
|
-
} else if (item.type === 'stylesheet') {
|
|
346
|
-
document.head.append(hm('link', _extends$1({
|
|
347
|
-
rel: 'stylesheet'
|
|
348
|
-
}, item.data)));
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
async function loadJS(items, context) {
|
|
352
|
-
items.forEach(item => {
|
|
353
|
-
var _item$data2;
|
|
354
|
-
if (item.type === 'script' && (_item$data2 = item.data) != null && _item$data2.src) {
|
|
355
|
-
memoizedPreloadJS(item.data.src);
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
context = _extends$1({
|
|
359
|
-
getMarkmap: () => window.markmap
|
|
360
|
-
}, context);
|
|
361
|
-
for (const item of items) {
|
|
362
|
-
await loadJSItem(item, context);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
function loadCSS(items) {
|
|
366
|
-
for (const item of items) {
|
|
367
|
-
loadCSSItem(item);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
function _extends() {
|
|
372
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
373
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
374
|
-
var source = arguments[i];
|
|
375
|
-
for (var key in source) {
|
|
376
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
377
|
-
target[key] = source[key];
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
return target;
|
|
382
|
-
};
|
|
383
|
-
return _extends.apply(this, arguments);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
function count(node) {
|
|
387
|
-
var sum = 0,
|
|
388
|
-
children = node.children,
|
|
389
|
-
i = children && children.length;
|
|
390
|
-
if (!i) sum = 1;else while (--i >= 0) sum += children[i].value;
|
|
391
|
-
node.value = sum;
|
|
392
|
-
}
|
|
393
|
-
function node_count () {
|
|
394
|
-
return this.eachAfter(count);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
function node_each (callback) {
|
|
398
|
-
var node = this,
|
|
399
|
-
current,
|
|
400
|
-
next = [node],
|
|
401
|
-
children,
|
|
402
|
-
i,
|
|
403
|
-
n;
|
|
404
|
-
do {
|
|
405
|
-
current = next.reverse(), next = [];
|
|
406
|
-
while (node = current.pop()) {
|
|
407
|
-
callback(node), children = node.children;
|
|
408
|
-
if (children) for (i = 0, n = children.length; i < n; ++i) {
|
|
409
|
-
next.push(children[i]);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
} while (next.length);
|
|
413
|
-
return this;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
function node_eachBefore (callback) {
|
|
417
|
-
var node = this,
|
|
418
|
-
nodes = [node],
|
|
419
|
-
children,
|
|
420
|
-
i;
|
|
421
|
-
while (node = nodes.pop()) {
|
|
422
|
-
callback(node), children = node.children;
|
|
423
|
-
if (children) for (i = children.length - 1; i >= 0; --i) {
|
|
424
|
-
nodes.push(children[i]);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
return this;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
function node_eachAfter (callback) {
|
|
431
|
-
var node = this,
|
|
432
|
-
nodes = [node],
|
|
433
|
-
next = [],
|
|
434
|
-
children,
|
|
435
|
-
i,
|
|
436
|
-
n;
|
|
437
|
-
while (node = nodes.pop()) {
|
|
438
|
-
next.push(node), children = node.children;
|
|
439
|
-
if (children) for (i = 0, n = children.length; i < n; ++i) {
|
|
440
|
-
nodes.push(children[i]);
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
while (node = next.pop()) {
|
|
444
|
-
callback(node);
|
|
445
|
-
}
|
|
446
|
-
return this;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
function node_sum (value) {
|
|
450
|
-
return this.eachAfter(function (node) {
|
|
451
|
-
var sum = +value(node.data) || 0,
|
|
452
|
-
children = node.children,
|
|
453
|
-
i = children && children.length;
|
|
454
|
-
while (--i >= 0) sum += children[i].value;
|
|
455
|
-
node.value = sum;
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
function node_sort (compare) {
|
|
460
|
-
return this.eachBefore(function (node) {
|
|
461
|
-
if (node.children) {
|
|
462
|
-
node.children.sort(compare);
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
function node_path (end) {
|
|
468
|
-
var start = this,
|
|
469
|
-
ancestor = leastCommonAncestor(start, end),
|
|
470
|
-
nodes = [start];
|
|
471
|
-
while (start !== ancestor) {
|
|
472
|
-
start = start.parent;
|
|
473
|
-
nodes.push(start);
|
|
474
|
-
}
|
|
475
|
-
var k = nodes.length;
|
|
476
|
-
while (end !== ancestor) {
|
|
477
|
-
nodes.splice(k, 0, end);
|
|
478
|
-
end = end.parent;
|
|
479
|
-
}
|
|
480
|
-
return nodes;
|
|
481
|
-
}
|
|
482
|
-
function leastCommonAncestor(a, b) {
|
|
483
|
-
if (a === b) return a;
|
|
484
|
-
var aNodes = a.ancestors(),
|
|
485
|
-
bNodes = b.ancestors(),
|
|
486
|
-
c = null;
|
|
487
|
-
a = aNodes.pop();
|
|
488
|
-
b = bNodes.pop();
|
|
489
|
-
while (a === b) {
|
|
490
|
-
c = a;
|
|
491
|
-
a = aNodes.pop();
|
|
492
|
-
b = bNodes.pop();
|
|
493
|
-
}
|
|
494
|
-
return c;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
function node_ancestors () {
|
|
498
|
-
var node = this,
|
|
499
|
-
nodes = [node];
|
|
500
|
-
while (node = node.parent) {
|
|
501
|
-
nodes.push(node);
|
|
502
|
-
}
|
|
503
|
-
return nodes;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
function node_descendants () {
|
|
507
|
-
var nodes = [];
|
|
508
|
-
this.each(function (node) {
|
|
509
|
-
nodes.push(node);
|
|
510
|
-
});
|
|
511
|
-
return nodes;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
function node_leaves () {
|
|
515
|
-
var leaves = [];
|
|
516
|
-
this.eachBefore(function (node) {
|
|
517
|
-
if (!node.children) {
|
|
518
|
-
leaves.push(node);
|
|
519
|
-
}
|
|
520
|
-
});
|
|
521
|
-
return leaves;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
function node_links () {
|
|
525
|
-
var root = this,
|
|
526
|
-
links = [];
|
|
527
|
-
root.each(function (node) {
|
|
528
|
-
if (node !== root) {
|
|
529
|
-
// Don’t include the root’s parent, if any.
|
|
530
|
-
links.push({
|
|
531
|
-
source: node.parent,
|
|
532
|
-
target: node
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
});
|
|
536
|
-
return links;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
function hierarchy(data, children) {
|
|
540
|
-
var root = new Node$1(data),
|
|
541
|
-
valued = +data.value && (root.value = data.value),
|
|
542
|
-
node,
|
|
543
|
-
nodes = [root],
|
|
544
|
-
child,
|
|
545
|
-
childs,
|
|
546
|
-
i,
|
|
547
|
-
n;
|
|
548
|
-
if (children == null) children = defaultChildren;
|
|
549
|
-
while (node = nodes.pop()) {
|
|
550
|
-
if (valued) node.value = +node.data.value;
|
|
551
|
-
if ((childs = children(node.data)) && (n = childs.length)) {
|
|
552
|
-
node.children = new Array(n);
|
|
553
|
-
for (i = n - 1; i >= 0; --i) {
|
|
554
|
-
nodes.push(child = node.children[i] = new Node$1(childs[i]));
|
|
555
|
-
child.parent = node;
|
|
556
|
-
child.depth = node.depth + 1;
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
return root.eachBefore(computeHeight);
|
|
561
|
-
}
|
|
562
|
-
function node_copy() {
|
|
563
|
-
return hierarchy(this).eachBefore(copyData);
|
|
564
|
-
}
|
|
565
|
-
function defaultChildren(d) {
|
|
566
|
-
return d.children;
|
|
567
|
-
}
|
|
568
|
-
function copyData(node) {
|
|
569
|
-
node.data = node.data.data;
|
|
570
|
-
}
|
|
571
|
-
function computeHeight(node) {
|
|
572
|
-
var height = 0;
|
|
573
|
-
do node.height = height; while ((node = node.parent) && node.height < ++height);
|
|
574
|
-
}
|
|
575
|
-
function Node$1(data) {
|
|
576
|
-
this.data = data;
|
|
577
|
-
this.depth = this.height = 0;
|
|
578
|
-
this.parent = null;
|
|
579
|
-
}
|
|
580
|
-
Node$1.prototype = hierarchy.prototype = {
|
|
581
|
-
constructor: Node$1,
|
|
582
|
-
count: node_count,
|
|
583
|
-
each: node_each,
|
|
584
|
-
eachAfter: node_eachAfter,
|
|
585
|
-
eachBefore: node_eachBefore,
|
|
586
|
-
sum: node_sum,
|
|
587
|
-
sort: node_sort,
|
|
588
|
-
path: node_path,
|
|
589
|
-
ancestors: node_ancestors,
|
|
590
|
-
descendants: node_descendants,
|
|
591
|
-
leaves: node_leaves,
|
|
592
|
-
links: node_links,
|
|
593
|
-
copy: node_copy
|
|
594
|
-
};
|
|
595
|
-
|
|
596
|
-
var name = "d3-flextree";
|
|
597
|
-
var version$1 = "2.1.2";
|
|
598
|
-
var main = "build/d3-flextree.js";
|
|
599
|
-
var module = "index";
|
|
600
|
-
var author = {
|
|
601
|
-
name: "Chris Maloney",
|
|
602
|
-
url: "http://chrismaloney.org"
|
|
603
|
-
};
|
|
604
|
-
var description = "Flexible tree layout algorithm that allows for variable node sizes.";
|
|
605
|
-
var keywords = [
|
|
606
|
-
"d3",
|
|
607
|
-
"d3-module",
|
|
608
|
-
"layout",
|
|
609
|
-
"tree",
|
|
610
|
-
"hierarchy",
|
|
611
|
-
"d3-hierarchy",
|
|
612
|
-
"plugin",
|
|
613
|
-
"d3-plugin",
|
|
614
|
-
"infovis",
|
|
615
|
-
"visualization",
|
|
616
|
-
"2d"
|
|
617
|
-
];
|
|
618
|
-
var homepage = "https://github.com/klortho/d3-flextree";
|
|
619
|
-
var license = "WTFPL";
|
|
620
|
-
var repository = {
|
|
621
|
-
type: "git",
|
|
622
|
-
url: "https://github.com/klortho/d3-flextree.git"
|
|
623
|
-
};
|
|
624
|
-
var scripts = {
|
|
625
|
-
clean: "rm -rf build demo test",
|
|
626
|
-
"build:demo": "rollup -c --environment BUILD:demo",
|
|
627
|
-
"build:dev": "rollup -c --environment BUILD:dev",
|
|
628
|
-
"build:prod": "rollup -c --environment BUILD:prod",
|
|
629
|
-
"build:test": "rollup -c --environment BUILD:test",
|
|
630
|
-
build: "rollup -c",
|
|
631
|
-
lint: "eslint index.js src",
|
|
632
|
-
"test:main": "node test/bundle.js",
|
|
633
|
-
"test:browser": "node test/browser-tests.js",
|
|
634
|
-
test: "npm-run-all test:*",
|
|
635
|
-
prepare: "npm-run-all clean build lint test"
|
|
636
|
-
};
|
|
637
|
-
var dependencies = {
|
|
638
|
-
"d3-hierarchy": "^1.1.5"
|
|
639
|
-
};
|
|
640
|
-
var devDependencies = {
|
|
641
|
-
"babel-plugin-external-helpers": "^6.22.0",
|
|
642
|
-
"babel-preset-es2015-rollup": "^3.0.0",
|
|
643
|
-
d3: "^4.13.0",
|
|
644
|
-
"d3-selection-multi": "^1.0.1",
|
|
645
|
-
eslint: "^4.19.1",
|
|
646
|
-
jsdom: "^11.6.2",
|
|
647
|
-
"npm-run-all": "^4.1.2",
|
|
648
|
-
rollup: "^0.55.3",
|
|
649
|
-
"rollup-plugin-babel": "^2.7.1",
|
|
650
|
-
"rollup-plugin-commonjs": "^8.0.2",
|
|
651
|
-
"rollup-plugin-copy": "^0.2.3",
|
|
652
|
-
"rollup-plugin-json": "^2.3.0",
|
|
653
|
-
"rollup-plugin-node-resolve": "^3.0.2",
|
|
654
|
-
"rollup-plugin-uglify": "^3.0.0",
|
|
655
|
-
"uglify-es": "^3.3.9"
|
|
656
|
-
};
|
|
657
|
-
var packageInfo = {
|
|
658
|
-
name: name,
|
|
659
|
-
version: version$1,
|
|
660
|
-
main: main,
|
|
661
|
-
module: module,
|
|
662
|
-
"jsnext:main": "index",
|
|
663
|
-
author: author,
|
|
664
|
-
description: description,
|
|
665
|
-
keywords: keywords,
|
|
666
|
-
homepage: homepage,
|
|
667
|
-
license: license,
|
|
668
|
-
repository: repository,
|
|
669
|
-
scripts: scripts,
|
|
670
|
-
dependencies: dependencies,
|
|
671
|
-
devDependencies: devDependencies
|
|
672
|
-
};
|
|
673
|
-
|
|
674
|
-
const {
|
|
675
|
-
version
|
|
676
|
-
} = packageInfo;
|
|
677
|
-
const defaults = Object.freeze({
|
|
678
|
-
children: data => data.children,
|
|
679
|
-
nodeSize: node => node.data.size,
|
|
680
|
-
spacing: 0
|
|
681
|
-
});
|
|
682
|
-
|
|
683
|
-
// Create a layout function with customizable options. Per D3-style, the
|
|
684
|
-
// options can be set at any time using setter methods. The layout function
|
|
685
|
-
// will compute the tree node positions based on the options in effect at the
|
|
686
|
-
// time it is called.
|
|
687
|
-
function flextree(options) {
|
|
688
|
-
const opts = Object.assign({}, defaults, options);
|
|
689
|
-
function accessor(name) {
|
|
690
|
-
const opt = opts[name];
|
|
691
|
-
return typeof opt === 'function' ? opt : () => opt;
|
|
692
|
-
}
|
|
693
|
-
function layout(tree) {
|
|
694
|
-
const wtree = wrap(getWrapper(), tree, node => node.children);
|
|
695
|
-
wtree.update();
|
|
696
|
-
return wtree.data;
|
|
697
|
-
}
|
|
698
|
-
function getFlexNode() {
|
|
699
|
-
const nodeSize = accessor('nodeSize');
|
|
700
|
-
const spacing = accessor('spacing');
|
|
701
|
-
return class FlexNode extends hierarchy.prototype.constructor {
|
|
702
|
-
constructor(data) {
|
|
703
|
-
super(data);
|
|
704
|
-
}
|
|
705
|
-
copy() {
|
|
706
|
-
const c = wrap(this.constructor, this, node => node.children);
|
|
707
|
-
c.each(node => node.data = node.data.data);
|
|
708
|
-
return c;
|
|
709
|
-
}
|
|
710
|
-
get size() {
|
|
711
|
-
return nodeSize(this);
|
|
712
|
-
}
|
|
713
|
-
spacing(oNode) {
|
|
714
|
-
return spacing(this, oNode);
|
|
715
|
-
}
|
|
716
|
-
get nodes() {
|
|
717
|
-
return this.descendants();
|
|
718
|
-
}
|
|
719
|
-
get xSize() {
|
|
720
|
-
return this.size[0];
|
|
721
|
-
}
|
|
722
|
-
get ySize() {
|
|
723
|
-
return this.size[1];
|
|
724
|
-
}
|
|
725
|
-
get top() {
|
|
726
|
-
return this.y;
|
|
727
|
-
}
|
|
728
|
-
get bottom() {
|
|
729
|
-
return this.y + this.ySize;
|
|
730
|
-
}
|
|
731
|
-
get left() {
|
|
732
|
-
return this.x - this.xSize / 2;
|
|
733
|
-
}
|
|
734
|
-
get right() {
|
|
735
|
-
return this.x + this.xSize / 2;
|
|
736
|
-
}
|
|
737
|
-
get root() {
|
|
738
|
-
const ancs = this.ancestors();
|
|
739
|
-
return ancs[ancs.length - 1];
|
|
740
|
-
}
|
|
741
|
-
get numChildren() {
|
|
742
|
-
return this.hasChildren ? this.children.length : 0;
|
|
743
|
-
}
|
|
744
|
-
get hasChildren() {
|
|
745
|
-
return !this.noChildren;
|
|
746
|
-
}
|
|
747
|
-
get noChildren() {
|
|
748
|
-
return this.children === null;
|
|
749
|
-
}
|
|
750
|
-
get firstChild() {
|
|
751
|
-
return this.hasChildren ? this.children[0] : null;
|
|
752
|
-
}
|
|
753
|
-
get lastChild() {
|
|
754
|
-
return this.hasChildren ? this.children[this.numChildren - 1] : null;
|
|
755
|
-
}
|
|
756
|
-
get extents() {
|
|
757
|
-
return (this.children || []).reduce((acc, kid) => FlexNode.maxExtents(acc, kid.extents), this.nodeExtents);
|
|
758
|
-
}
|
|
759
|
-
get nodeExtents() {
|
|
760
|
-
return {
|
|
761
|
-
top: this.top,
|
|
762
|
-
bottom: this.bottom,
|
|
763
|
-
left: this.left,
|
|
764
|
-
right: this.right
|
|
765
|
-
};
|
|
766
|
-
}
|
|
767
|
-
static maxExtents(e0, e1) {
|
|
768
|
-
return {
|
|
769
|
-
top: Math.min(e0.top, e1.top),
|
|
770
|
-
bottom: Math.max(e0.bottom, e1.bottom),
|
|
771
|
-
left: Math.min(e0.left, e1.left),
|
|
772
|
-
right: Math.max(e0.right, e1.right)
|
|
773
|
-
};
|
|
774
|
-
}
|
|
775
|
-
};
|
|
776
|
-
}
|
|
777
|
-
function getWrapper() {
|
|
778
|
-
const FlexNode = getFlexNode();
|
|
779
|
-
const nodeSize = accessor('nodeSize');
|
|
780
|
-
const spacing = accessor('spacing');
|
|
781
|
-
return class extends FlexNode {
|
|
782
|
-
constructor(data) {
|
|
783
|
-
super(data);
|
|
784
|
-
Object.assign(this, {
|
|
785
|
-
x: 0,
|
|
786
|
-
y: 0,
|
|
787
|
-
relX: 0,
|
|
788
|
-
prelim: 0,
|
|
789
|
-
shift: 0,
|
|
790
|
-
change: 0,
|
|
791
|
-
lExt: this,
|
|
792
|
-
lExtRelX: 0,
|
|
793
|
-
lThr: null,
|
|
794
|
-
rExt: this,
|
|
795
|
-
rExtRelX: 0,
|
|
796
|
-
rThr: null
|
|
797
|
-
});
|
|
798
|
-
}
|
|
799
|
-
get size() {
|
|
800
|
-
return nodeSize(this.data);
|
|
801
|
-
}
|
|
802
|
-
spacing(oNode) {
|
|
803
|
-
return spacing(this.data, oNode.data);
|
|
804
|
-
}
|
|
805
|
-
get x() {
|
|
806
|
-
return this.data.x;
|
|
807
|
-
}
|
|
808
|
-
set x(v) {
|
|
809
|
-
this.data.x = v;
|
|
810
|
-
}
|
|
811
|
-
get y() {
|
|
812
|
-
return this.data.y;
|
|
813
|
-
}
|
|
814
|
-
set y(v) {
|
|
815
|
-
this.data.y = v;
|
|
816
|
-
}
|
|
817
|
-
update() {
|
|
818
|
-
layoutChildren(this);
|
|
819
|
-
resolveX(this);
|
|
820
|
-
return this;
|
|
821
|
-
}
|
|
822
|
-
};
|
|
823
|
-
}
|
|
824
|
-
function wrap(FlexClass, treeData, children) {
|
|
825
|
-
const _wrap = (data, parent) => {
|
|
826
|
-
const node = new FlexClass(data);
|
|
827
|
-
Object.assign(node, {
|
|
828
|
-
parent,
|
|
829
|
-
depth: parent === null ? 0 : parent.depth + 1,
|
|
830
|
-
height: 0,
|
|
831
|
-
length: 1
|
|
832
|
-
});
|
|
833
|
-
const kidsData = children(data) || [];
|
|
834
|
-
node.children = kidsData.length === 0 ? null : kidsData.map(kd => _wrap(kd, node));
|
|
835
|
-
if (node.children) {
|
|
836
|
-
Object.assign(node, node.children.reduce((hl, kid) => ({
|
|
837
|
-
height: Math.max(hl.height, kid.height + 1),
|
|
838
|
-
length: hl.length + kid.length
|
|
839
|
-
}), node));
|
|
840
|
-
}
|
|
841
|
-
return node;
|
|
842
|
-
};
|
|
843
|
-
return _wrap(treeData, null);
|
|
844
|
-
}
|
|
845
|
-
Object.assign(layout, {
|
|
846
|
-
nodeSize(arg) {
|
|
847
|
-
return arguments.length ? (opts.nodeSize = arg, layout) : opts.nodeSize;
|
|
848
|
-
},
|
|
849
|
-
spacing(arg) {
|
|
850
|
-
return arguments.length ? (opts.spacing = arg, layout) : opts.spacing;
|
|
851
|
-
},
|
|
852
|
-
children(arg) {
|
|
853
|
-
return arguments.length ? (opts.children = arg, layout) : opts.children;
|
|
854
|
-
},
|
|
855
|
-
hierarchy(treeData, children) {
|
|
856
|
-
const kids = typeof children === 'undefined' ? opts.children : children;
|
|
857
|
-
return wrap(getFlexNode(), treeData, kids);
|
|
858
|
-
},
|
|
859
|
-
dump(tree) {
|
|
860
|
-
const nodeSize = accessor('nodeSize');
|
|
861
|
-
const _dump = i0 => node => {
|
|
862
|
-
const i1 = i0 + ' ';
|
|
863
|
-
const i2 = i0 + ' ';
|
|
864
|
-
const {
|
|
865
|
-
x,
|
|
866
|
-
y
|
|
867
|
-
} = node;
|
|
868
|
-
const size = nodeSize(node);
|
|
869
|
-
const kids = node.children || [];
|
|
870
|
-
const kdumps = kids.length === 0 ? ' ' : `,${i1}children: [${i2}${kids.map(_dump(i2)).join(i2)}${i1}],${i0}`;
|
|
871
|
-
return `{ size: [${size.join(', ')}],${i1}x: ${x}, y: ${y}${kdumps}},`;
|
|
872
|
-
};
|
|
873
|
-
return _dump('\n')(tree);
|
|
874
|
-
}
|
|
875
|
-
});
|
|
876
|
-
return layout;
|
|
877
|
-
}
|
|
878
|
-
flextree.version = version;
|
|
879
|
-
const layoutChildren = (w, y = 0) => {
|
|
880
|
-
w.y = y;
|
|
881
|
-
(w.children || []).reduce((acc, kid) => {
|
|
882
|
-
const [i, lastLows] = acc;
|
|
883
|
-
layoutChildren(kid, w.y + w.ySize);
|
|
884
|
-
// The lowest vertical coordinate while extreme nodes still point
|
|
885
|
-
// in current subtree.
|
|
886
|
-
const lowY = (i === 0 ? kid.lExt : kid.rExt).bottom;
|
|
887
|
-
if (i !== 0) separate(w, i, lastLows);
|
|
888
|
-
const lows = updateLows(lowY, i, lastLows);
|
|
889
|
-
return [i + 1, lows];
|
|
890
|
-
}, [0, null]);
|
|
891
|
-
shiftChange(w);
|
|
892
|
-
positionRoot(w);
|
|
893
|
-
return w;
|
|
894
|
-
};
|
|
895
|
-
|
|
896
|
-
// Resolves the relative coordinate properties - relX and prelim --
|
|
897
|
-
// to set the final, absolute x coordinate for each node. This also sets
|
|
898
|
-
// `prelim` to 0, so that `relX` for each node is its x-coordinate relative
|
|
899
|
-
// to its parent.
|
|
900
|
-
const resolveX = (w, prevSum, parentX) => {
|
|
901
|
-
// A call to resolveX without arguments is assumed to be for the root of
|
|
902
|
-
// the tree. This will set the root's x-coord to zero.
|
|
903
|
-
if (typeof prevSum === 'undefined') {
|
|
904
|
-
prevSum = -w.relX - w.prelim;
|
|
905
|
-
parentX = 0;
|
|
906
|
-
}
|
|
907
|
-
const sum = prevSum + w.relX;
|
|
908
|
-
w.relX = sum + w.prelim - parentX;
|
|
909
|
-
w.prelim = 0;
|
|
910
|
-
w.x = parentX + w.relX;
|
|
911
|
-
(w.children || []).forEach(k => resolveX(k, sum, w.x));
|
|
912
|
-
return w;
|
|
913
|
-
};
|
|
914
|
-
|
|
915
|
-
// Process shift and change for all children, to add intermediate spacing to
|
|
916
|
-
// each child's modifier.
|
|
917
|
-
const shiftChange = w => {
|
|
918
|
-
(w.children || []).reduce((acc, child) => {
|
|
919
|
-
const [lastShiftSum, lastChangeSum] = acc;
|
|
920
|
-
const shiftSum = lastShiftSum + child.shift;
|
|
921
|
-
const changeSum = lastChangeSum + shiftSum + child.change;
|
|
922
|
-
child.relX += changeSum;
|
|
923
|
-
return [shiftSum, changeSum];
|
|
924
|
-
}, [0, 0]);
|
|
925
|
-
};
|
|
926
|
-
|
|
927
|
-
// Separates the latest child from its previous sibling
|
|
928
|
-
/* eslint-disable complexity */
|
|
929
|
-
const separate = (w, i, lows) => {
|
|
930
|
-
const lSib = w.children[i - 1];
|
|
931
|
-
const curSubtree = w.children[i];
|
|
932
|
-
let rContour = lSib;
|
|
933
|
-
let rSumMods = lSib.relX;
|
|
934
|
-
let lContour = curSubtree;
|
|
935
|
-
let lSumMods = curSubtree.relX;
|
|
936
|
-
let isFirst = true;
|
|
937
|
-
while (rContour && lContour) {
|
|
938
|
-
if (rContour.bottom > lows.lowY) lows = lows.next;
|
|
939
|
-
// How far to the left of the right side of rContour is the left side
|
|
940
|
-
// of lContour? First compute the center-to-center distance, then add
|
|
941
|
-
// the "spacing"
|
|
942
|
-
const dist = rSumMods + rContour.prelim - (lSumMods + lContour.prelim) + rContour.xSize / 2 + lContour.xSize / 2 + rContour.spacing(lContour);
|
|
943
|
-
if (dist > 0 || dist < 0 && isFirst) {
|
|
944
|
-
lSumMods += dist;
|
|
945
|
-
// Move subtree by changing relX.
|
|
946
|
-
moveSubtree(curSubtree, dist);
|
|
947
|
-
distributeExtra(w, i, lows.index, dist);
|
|
948
|
-
}
|
|
949
|
-
isFirst = false;
|
|
950
|
-
// Advance highest node(s) and sum(s) of modifiers
|
|
951
|
-
const rightBottom = rContour.bottom;
|
|
952
|
-
const leftBottom = lContour.bottom;
|
|
953
|
-
if (rightBottom <= leftBottom) {
|
|
954
|
-
rContour = nextRContour(rContour);
|
|
955
|
-
if (rContour) rSumMods += rContour.relX;
|
|
956
|
-
}
|
|
957
|
-
if (rightBottom >= leftBottom) {
|
|
958
|
-
lContour = nextLContour(lContour);
|
|
959
|
-
if (lContour) lSumMods += lContour.relX;
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
// Set threads and update extreme nodes. In the first case, the
|
|
963
|
-
// current subtree is taller than the left siblings.
|
|
964
|
-
if (!rContour && lContour) setLThr(w, i, lContour, lSumMods);
|
|
965
|
-
// In the next case, the left siblings are taller than the current subtree
|
|
966
|
-
else if (rContour && !lContour) setRThr(w, i, rContour, rSumMods);
|
|
967
|
-
};
|
|
968
|
-
/* eslint-enable complexity */
|
|
969
|
-
|
|
970
|
-
// Move subtree by changing relX.
|
|
971
|
-
const moveSubtree = (subtree, distance) => {
|
|
972
|
-
subtree.relX += distance;
|
|
973
|
-
subtree.lExtRelX += distance;
|
|
974
|
-
subtree.rExtRelX += distance;
|
|
975
|
-
};
|
|
976
|
-
const distributeExtra = (w, curSubtreeI, leftSibI, dist) => {
|
|
977
|
-
const curSubtree = w.children[curSubtreeI];
|
|
978
|
-
const n = curSubtreeI - leftSibI;
|
|
979
|
-
// Are there intermediate children?
|
|
980
|
-
if (n > 1) {
|
|
981
|
-
const delta = dist / n;
|
|
982
|
-
w.children[leftSibI + 1].shift += delta;
|
|
983
|
-
curSubtree.shift -= delta;
|
|
984
|
-
curSubtree.change -= dist - delta;
|
|
985
|
-
}
|
|
986
|
-
};
|
|
987
|
-
const nextLContour = w => {
|
|
988
|
-
return w.hasChildren ? w.firstChild : w.lThr;
|
|
989
|
-
};
|
|
990
|
-
const nextRContour = w => {
|
|
991
|
-
return w.hasChildren ? w.lastChild : w.rThr;
|
|
992
|
-
};
|
|
993
|
-
const setLThr = (w, i, lContour, lSumMods) => {
|
|
994
|
-
const firstChild = w.firstChild;
|
|
995
|
-
const lExt = firstChild.lExt;
|
|
996
|
-
const curSubtree = w.children[i];
|
|
997
|
-
lExt.lThr = lContour;
|
|
998
|
-
// Change relX so that the sum of modifier after following thread is correct.
|
|
999
|
-
const diff = lSumMods - lContour.relX - firstChild.lExtRelX;
|
|
1000
|
-
lExt.relX += diff;
|
|
1001
|
-
// Change preliminary x coordinate so that the node does not move.
|
|
1002
|
-
lExt.prelim -= diff;
|
|
1003
|
-
// Update extreme node and its sum of modifiers.
|
|
1004
|
-
firstChild.lExt = curSubtree.lExt;
|
|
1005
|
-
firstChild.lExtRelX = curSubtree.lExtRelX;
|
|
1006
|
-
};
|
|
1007
|
-
|
|
1008
|
-
// Mirror image of setLThr.
|
|
1009
|
-
const setRThr = (w, i, rContour, rSumMods) => {
|
|
1010
|
-
const curSubtree = w.children[i];
|
|
1011
|
-
const rExt = curSubtree.rExt;
|
|
1012
|
-
const lSib = w.children[i - 1];
|
|
1013
|
-
rExt.rThr = rContour;
|
|
1014
|
-
const diff = rSumMods - rContour.relX - curSubtree.rExtRelX;
|
|
1015
|
-
rExt.relX += diff;
|
|
1016
|
-
rExt.prelim -= diff;
|
|
1017
|
-
curSubtree.rExt = lSib.rExt;
|
|
1018
|
-
curSubtree.rExtRelX = lSib.rExtRelX;
|
|
1019
|
-
};
|
|
1020
|
-
|
|
1021
|
-
// Position root between children, taking into account their modifiers
|
|
1022
|
-
const positionRoot = w => {
|
|
1023
|
-
if (w.hasChildren) {
|
|
1024
|
-
const k0 = w.firstChild;
|
|
1025
|
-
const kf = w.lastChild;
|
|
1026
|
-
const prelim = (k0.prelim + k0.relX - k0.xSize / 2 + kf.relX + kf.prelim + kf.xSize / 2) / 2;
|
|
1027
|
-
Object.assign(w, {
|
|
1028
|
-
prelim,
|
|
1029
|
-
lExt: k0.lExt,
|
|
1030
|
-
lExtRelX: k0.lExtRelX,
|
|
1031
|
-
rExt: kf.rExt,
|
|
1032
|
-
rExtRelX: kf.rExtRelX
|
|
1033
|
-
});
|
|
1034
|
-
}
|
|
1035
|
-
};
|
|
1036
|
-
|
|
1037
|
-
// Make/maintain a linked list of the indexes of left siblings and their
|
|
1038
|
-
// lowest vertical coordinate.
|
|
1039
|
-
const updateLows = (lowY, index, lastLows) => {
|
|
1040
|
-
// Remove siblings that are hidden by the new subtree.
|
|
1041
|
-
while (lastLows !== null && lowY >= lastLows.lowY) lastLows = lastLows.next;
|
|
1042
|
-
// Prepend the new subtree.
|
|
1043
|
-
return {
|
|
1044
|
-
lowY,
|
|
1045
|
-
index,
|
|
1046
|
-
next: lastLows
|
|
1047
|
-
};
|
|
1048
|
-
};
|
|
1049
|
-
|
|
1050
|
-
/*! @gera2ld/jsx-dom v2.2.2 | ISC License */
|
|
1051
|
-
const VTYPE_ELEMENT = 1;
|
|
1052
|
-
const VTYPE_FUNCTION = 2;
|
|
1053
|
-
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
1054
|
-
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
1055
|
-
const NS_ATTRS = {
|
|
1056
|
-
show: XLINK_NS,
|
|
1057
|
-
actuate: XLINK_NS,
|
|
1058
|
-
href: XLINK_NS
|
|
1059
|
-
};
|
|
1060
|
-
const isLeaf = c => typeof c === 'string' || typeof c === 'number';
|
|
1061
|
-
const isElement = c => (c == null ? void 0 : c.vtype) === VTYPE_ELEMENT;
|
|
1062
|
-
const isRenderFunction = c => (c == null ? void 0 : c.vtype) === VTYPE_FUNCTION;
|
|
1063
|
-
function jsx(type, props) {
|
|
1064
|
-
let vtype;
|
|
1065
|
-
if (typeof type === 'string') vtype = VTYPE_ELEMENT;else if (typeof type === 'function') vtype = VTYPE_FUNCTION;else throw new Error('Invalid VNode type');
|
|
1066
|
-
return {
|
|
1067
|
-
vtype,
|
|
1068
|
-
type,
|
|
1069
|
-
props
|
|
1070
|
-
};
|
|
1071
|
-
}
|
|
1072
|
-
function Fragment(props) {
|
|
1073
|
-
return props.children;
|
|
1074
|
-
}
|
|
1075
|
-
const DEFAULT_ENV = {
|
|
1076
|
-
isSvg: false
|
|
1077
|
-
};
|
|
1078
|
-
function insertDom(parent, nodes) {
|
|
1079
|
-
if (!Array.isArray(nodes)) nodes = [nodes];
|
|
1080
|
-
nodes = nodes.filter(Boolean);
|
|
1081
|
-
if (nodes.length) parent.append(...nodes);
|
|
1082
|
-
}
|
|
1083
|
-
function mountAttributes(domElement, props, env) {
|
|
1084
|
-
for (const key in props) {
|
|
1085
|
-
if (key === 'key' || key === 'children' || key === 'ref') continue;
|
|
1086
|
-
if (key === 'dangerouslySetInnerHTML') {
|
|
1087
|
-
domElement.innerHTML = props[key].__html;
|
|
1088
|
-
} else if (key === 'innerHTML' || key === 'textContent' || key === 'innerText' || key === 'value' && ['textarea', 'select'].includes(domElement.tagName)) {
|
|
1089
|
-
const value = props[key];
|
|
1090
|
-
if (value != null) domElement[key] = value;
|
|
1091
|
-
} else if (key.startsWith('on')) {
|
|
1092
|
-
domElement[key.toLowerCase()] = props[key];
|
|
1093
|
-
} else {
|
|
1094
|
-
setDOMAttribute(domElement, key, props[key], env.isSvg);
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
const attrMap = {
|
|
1099
|
-
className: 'class',
|
|
1100
|
-
labelFor: 'for'
|
|
1101
|
-
};
|
|
1102
|
-
function setDOMAttribute(el, attr, value, isSVG) {
|
|
1103
|
-
attr = attrMap[attr] || attr;
|
|
1104
|
-
if (value === true) {
|
|
1105
|
-
el.setAttribute(attr, '');
|
|
1106
|
-
} else if (value === false) {
|
|
1107
|
-
el.removeAttribute(attr);
|
|
1108
|
-
} else {
|
|
1109
|
-
const namespace = isSVG ? NS_ATTRS[attr] : undefined;
|
|
1110
|
-
if (namespace !== undefined) {
|
|
1111
|
-
el.setAttributeNS(namespace, attr, value);
|
|
1112
|
-
} else {
|
|
1113
|
-
el.setAttribute(attr, value);
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
function flatten(arr) {
|
|
1118
|
-
return arr.reduce((prev, item) => prev.concat(item), []);
|
|
1119
|
-
}
|
|
1120
|
-
function mountChildren(children, env) {
|
|
1121
|
-
return Array.isArray(children) ? flatten(children.map(child => mountChildren(child, env))) : mount(children, env);
|
|
1122
|
-
}
|
|
1123
|
-
function mount(vnode, env = DEFAULT_ENV) {
|
|
1124
|
-
if (vnode == null || typeof vnode === 'boolean') {
|
|
1125
|
-
return null;
|
|
1126
|
-
}
|
|
1127
|
-
if (vnode instanceof Node) {
|
|
1128
|
-
return vnode;
|
|
1129
|
-
}
|
|
1130
|
-
if (isRenderFunction(vnode)) {
|
|
1131
|
-
const {
|
|
1132
|
-
type,
|
|
1133
|
-
props
|
|
1134
|
-
} = vnode;
|
|
1135
|
-
if (type === Fragment) {
|
|
1136
|
-
const node = document.createDocumentFragment();
|
|
1137
|
-
if (props.children) {
|
|
1138
|
-
const children = mountChildren(props.children, env);
|
|
1139
|
-
insertDom(node, children);
|
|
1140
|
-
}
|
|
1141
|
-
return node;
|
|
1142
|
-
}
|
|
1143
|
-
const childVNode = type(props);
|
|
1144
|
-
return mount(childVNode, env);
|
|
1145
|
-
}
|
|
1146
|
-
if (isLeaf(vnode)) {
|
|
1147
|
-
return document.createTextNode(`${vnode}`);
|
|
1148
|
-
}
|
|
1149
|
-
if (isElement(vnode)) {
|
|
1150
|
-
let node;
|
|
1151
|
-
const {
|
|
1152
|
-
type,
|
|
1153
|
-
props
|
|
1154
|
-
} = vnode;
|
|
1155
|
-
if (!env.isSvg && type === 'svg') {
|
|
1156
|
-
env = Object.assign({}, env, {
|
|
1157
|
-
isSvg: true
|
|
1158
|
-
});
|
|
1159
|
-
}
|
|
1160
|
-
if (!env.isSvg) {
|
|
1161
|
-
node = document.createElement(type);
|
|
1162
|
-
} else {
|
|
1163
|
-
node = document.createElementNS(SVG_NS, type);
|
|
1164
|
-
}
|
|
1165
|
-
mountAttributes(node, props, env);
|
|
1166
|
-
if (props.children) {
|
|
1167
|
-
let childEnv = env;
|
|
1168
|
-
if (env.isSvg && type === 'foreignObject') {
|
|
1169
|
-
childEnv = Object.assign({}, childEnv, {
|
|
1170
|
-
isSvg: false
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
const children = mountChildren(props.children, childEnv);
|
|
1174
|
-
if (children != null) insertDom(node, children);
|
|
1175
|
-
}
|
|
1176
|
-
const {
|
|
1177
|
-
ref
|
|
1178
|
-
} = props;
|
|
1179
|
-
if (typeof ref === 'function') ref(node);
|
|
1180
|
-
return node;
|
|
1181
|
-
}
|
|
1182
|
-
throw new Error('mount: Invalid Vnode!');
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
|
-
/**
|
|
1186
|
-
* Mount vdom as real DOM nodes.
|
|
1187
|
-
*/
|
|
1188
|
-
function mountDom(vnode) {
|
|
1189
|
-
return mount(vnode);
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
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);padding:.25em}.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:#ffeaa7}";
|
|
1193
|
-
|
|
1194
|
-
var css_248z = ".markmap-container{height:0;left:-100px;overflow:hidden;position:absolute;top:-100px;width:0}.markmap-container>.markmap-foreign{display:inline-block}.markmap-container>.markmap-foreign>div:last-child,.markmap-container>.markmap-foreign>div:last-child *{white-space:nowrap}";
|
|
1195
|
-
|
|
1196
|
-
const globalCSS = css_248z$1;
|
|
1197
|
-
function linkWidth(nodeData) {
|
|
1198
|
-
const data = nodeData.data;
|
|
1199
|
-
return Math.max(4 - 2 * data.depth, 1.5);
|
|
1200
|
-
}
|
|
1201
|
-
function minBy(numbers, by) {
|
|
1202
|
-
const index = d3.minIndex(numbers, by);
|
|
1203
|
-
return numbers[index];
|
|
1204
|
-
}
|
|
1205
|
-
function stopPropagation(e) {
|
|
1206
|
-
e.stopPropagation();
|
|
1207
|
-
}
|
|
1208
|
-
function createViewHooks() {
|
|
1209
|
-
return {
|
|
1210
|
-
transformHtml: new Hook()
|
|
1211
|
-
};
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
/**
|
|
1215
|
-
* A global hook to refresh all markmaps when called.
|
|
1216
|
-
*/
|
|
1217
|
-
const refreshHook = new Hook();
|
|
1218
|
-
const defaultColorFn = d3.scaleOrdinal(d3.schemeCategory10);
|
|
1219
|
-
const isMacintosh = typeof navigator !== 'undefined' && navigator.userAgent.includes('Macintosh');
|
|
1220
|
-
class Markmap {
|
|
1221
|
-
constructor(svg, opts) {
|
|
1222
|
-
this.options = Markmap.defaultOptions;
|
|
1223
|
-
this.revokers = [];
|
|
1224
|
-
this.handleZoom = e => {
|
|
1225
|
-
const {
|
|
1226
|
-
transform
|
|
1227
|
-
} = e;
|
|
1228
|
-
this.g.attr('transform', transform);
|
|
1229
|
-
};
|
|
1230
|
-
this.handlePan = e => {
|
|
1231
|
-
e.preventDefault();
|
|
1232
|
-
const transform = d3.zoomTransform(this.svg.node());
|
|
1233
|
-
const newTransform = transform.translate(-e.deltaX / transform.k, -e.deltaY / transform.k);
|
|
1234
|
-
this.svg.call(this.zoom.transform, newTransform);
|
|
1235
|
-
};
|
|
1236
|
-
this.handleClick = (e, d) => {
|
|
1237
|
-
let recursive = this.options.toggleRecursively;
|
|
1238
|
-
if (isMacintosh ? e.metaKey : e.ctrlKey) recursive = !recursive;
|
|
1239
|
-
this.toggleNode(d.data, recursive);
|
|
1240
|
-
};
|
|
1241
|
-
this.viewHooks = createViewHooks();
|
|
1242
|
-
this.svg = svg.datum ? svg : d3.select(svg);
|
|
1243
|
-
this.styleNode = this.svg.append('style');
|
|
1244
|
-
this.zoom = d3.zoom().filter(event => {
|
|
1245
|
-
if (this.options.scrollForPan) {
|
|
1246
|
-
// Pan with wheels, zoom with ctrl+wheels
|
|
1247
|
-
if (event.type === 'wheel') return event.ctrlKey && !event.button;
|
|
1248
|
-
}
|
|
1249
|
-
return (!event.ctrlKey || event.type === 'wheel') && !event.button;
|
|
1250
|
-
}).on('zoom', this.handleZoom);
|
|
1251
|
-
this.setOptions(opts);
|
|
1252
|
-
this.state = {
|
|
1253
|
-
id: this.options.id || this.svg.attr('id') || getId(),
|
|
1254
|
-
minX: 0,
|
|
1255
|
-
maxX: 0,
|
|
1256
|
-
minY: 0,
|
|
1257
|
-
maxY: 0
|
|
1258
|
-
};
|
|
1259
|
-
this.g = this.svg.append('g');
|
|
1260
|
-
this.revokers.push(refreshHook.tap(() => {
|
|
1261
|
-
this.setData();
|
|
1262
|
-
}));
|
|
1263
|
-
}
|
|
1264
|
-
getStyleContent() {
|
|
1265
|
-
const {
|
|
1266
|
-
style
|
|
1267
|
-
} = this.options;
|
|
1268
|
-
const {
|
|
1269
|
-
id
|
|
1270
|
-
} = this.state;
|
|
1271
|
-
const styleText = typeof style === 'function' ? style(id) : '';
|
|
1272
|
-
return [this.options.embedGlobalCSS && css_248z$1, styleText].filter(Boolean).join('\n');
|
|
1273
|
-
}
|
|
1274
|
-
updateStyle() {
|
|
1275
|
-
this.svg.attr('class', addClass(this.svg.attr('class'), 'markmap', this.state.id));
|
|
1276
|
-
const style = this.getStyleContent();
|
|
1277
|
-
this.styleNode.text(style);
|
|
1278
|
-
}
|
|
1279
|
-
toggleNode(data, recursive = false) {
|
|
1280
|
-
var _data$payload;
|
|
1281
|
-
const fold = (_data$payload = data.payload) != null && _data$payload.fold ? 0 : 1;
|
|
1282
|
-
if (recursive) {
|
|
1283
|
-
// recursively
|
|
1284
|
-
walkTree(data, (item, next) => {
|
|
1285
|
-
item.payload = _extends({}, item.payload, {
|
|
1286
|
-
fold
|
|
1287
|
-
});
|
|
1288
|
-
next();
|
|
1289
|
-
});
|
|
1290
|
-
} else {
|
|
1291
|
-
var _data$payload2;
|
|
1292
|
-
data.payload = _extends({}, data.payload, {
|
|
1293
|
-
fold: (_data$payload2 = data.payload) != null && _data$payload2.fold ? 0 : 1
|
|
1294
|
-
});
|
|
1295
|
-
}
|
|
1296
|
-
this.renderData(data);
|
|
1297
|
-
}
|
|
1298
|
-
initializeData(node) {
|
|
1299
|
-
let nodeId = 0;
|
|
1300
|
-
const {
|
|
1301
|
-
color,
|
|
1302
|
-
nodeMinHeight,
|
|
1303
|
-
maxWidth,
|
|
1304
|
-
initialExpandLevel
|
|
1305
|
-
} = this.options;
|
|
1306
|
-
const {
|
|
1307
|
-
id
|
|
1308
|
-
} = this.state;
|
|
1309
|
-
const container = mountDom(jsx("div", {
|
|
1310
|
-
className: `markmap-container markmap ${id}-g`
|
|
1311
|
-
}));
|
|
1312
|
-
const style = mountDom(jsx("style", {
|
|
1313
|
-
children: [this.getStyleContent(), css_248z].join('\n')
|
|
1314
|
-
}));
|
|
1315
|
-
document.body.append(container, style);
|
|
1316
|
-
const groupStyle = maxWidth ? `max-width: ${maxWidth}px` : '';
|
|
1317
|
-
let foldRecursively = 0;
|
|
1318
|
-
walkTree(node, (item, next, parent) => {
|
|
1319
|
-
var _item$children, _parent$state, _item$payload;
|
|
1320
|
-
item.children = (_item$children = item.children) == null ? void 0 : _item$children.map(child => _extends({}, child));
|
|
1321
|
-
nodeId += 1;
|
|
1322
|
-
const group = mountDom(jsx("div", {
|
|
1323
|
-
className: "markmap-foreign",
|
|
1324
|
-
style: groupStyle,
|
|
1325
|
-
children: jsx("div", {
|
|
1326
|
-
dangerouslySetInnerHTML: {
|
|
1327
|
-
__html: item.content
|
|
1328
|
-
}
|
|
1329
|
-
})
|
|
1330
|
-
}));
|
|
1331
|
-
container.append(group);
|
|
1332
|
-
item.state = _extends({}, item.state, {
|
|
1333
|
-
id: nodeId,
|
|
1334
|
-
el: group.firstChild
|
|
1335
|
-
});
|
|
1336
|
-
item.state.path = [parent == null || (_parent$state = parent.state) == null ? void 0 : _parent$state.path, item.state.id].filter(Boolean).join('.');
|
|
1337
|
-
color(item); // preload colors
|
|
1338
|
-
|
|
1339
|
-
const isFoldRecursively = ((_item$payload = item.payload) == null ? void 0 : _item$payload.fold) === 2;
|
|
1340
|
-
if (isFoldRecursively) {
|
|
1341
|
-
foldRecursively += 1;
|
|
1342
|
-
} else if (foldRecursively || initialExpandLevel >= 0 && item.depth >= initialExpandLevel) {
|
|
1343
|
-
item.payload = _extends({}, item.payload, {
|
|
1344
|
-
fold: 1
|
|
1345
|
-
});
|
|
1346
|
-
}
|
|
1347
|
-
next();
|
|
1348
|
-
if (isFoldRecursively) foldRecursively -= 1;
|
|
1349
|
-
});
|
|
1350
|
-
const nodes = Array.from(container.childNodes).map(group => group.firstChild);
|
|
1351
|
-
this.viewHooks.transformHtml.call(this, nodes);
|
|
1352
|
-
// Clone the rendered HTML and set `white-space: nowrap` to it to detect its max-width.
|
|
1353
|
-
// The parent node will have a width of the max-width and the original content without
|
|
1354
|
-
// `white-space: nowrap` gets re-layouted, then we will get the expected layout, with
|
|
1355
|
-
// content in one line as much as possible, and subjecting to the given max-width.
|
|
1356
|
-
nodes.forEach(node => {
|
|
1357
|
-
var _node$parentNode;
|
|
1358
|
-
(_node$parentNode = node.parentNode) == null || _node$parentNode.append(node.cloneNode(true));
|
|
1359
|
-
});
|
|
1360
|
-
walkTree(node, (item, next, parent) => {
|
|
1361
|
-
var _parent$state2;
|
|
1362
|
-
const state = item.state;
|
|
1363
|
-
const rect = state.el.getBoundingClientRect();
|
|
1364
|
-
item.content = state.el.innerHTML;
|
|
1365
|
-
state.size = [Math.ceil(rect.width) + 1, Math.max(Math.ceil(rect.height), nodeMinHeight)];
|
|
1366
|
-
state.key = [parent == null || (_parent$state2 = parent.state) == null ? void 0 : _parent$state2.id, state.id].filter(Boolean).join('.') +
|
|
1367
|
-
// FIXME: find a way to check content hash
|
|
1368
|
-
item.content;
|
|
1369
|
-
next();
|
|
1370
|
-
});
|
|
1371
|
-
container.remove();
|
|
1372
|
-
style.remove();
|
|
1373
|
-
}
|
|
1374
|
-
setOptions(opts) {
|
|
1375
|
-
this.options = _extends({}, this.options, opts);
|
|
1376
|
-
if (this.options.zoom) {
|
|
1377
|
-
this.svg.call(this.zoom);
|
|
1378
|
-
} else {
|
|
1379
|
-
this.svg.on('.zoom', null);
|
|
1380
|
-
}
|
|
1381
|
-
if (this.options.pan) {
|
|
1382
|
-
this.svg.on('wheel', this.handlePan);
|
|
1383
|
-
} else {
|
|
1384
|
-
this.svg.on('wheel', null);
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
setData(data, opts) {
|
|
1388
|
-
if (opts) this.setOptions(opts);
|
|
1389
|
-
if (data) this.state.data = data;
|
|
1390
|
-
if (!this.state.data) return;
|
|
1391
|
-
this.initializeData(this.state.data);
|
|
1392
|
-
this.updateStyle();
|
|
1393
|
-
this.renderData();
|
|
1394
|
-
}
|
|
1395
|
-
renderData(originData) {
|
|
1396
|
-
var _origin$data$state$x, _origin$data$state$y;
|
|
1397
|
-
if (!this.state.data) return;
|
|
1398
|
-
const {
|
|
1399
|
-
spacingHorizontal,
|
|
1400
|
-
paddingX,
|
|
1401
|
-
spacingVertical,
|
|
1402
|
-
autoFit,
|
|
1403
|
-
color
|
|
1404
|
-
} = this.options;
|
|
1405
|
-
const layout = flextree({}).children(d => {
|
|
1406
|
-
var _d$payload;
|
|
1407
|
-
if (!((_d$payload = d.payload) != null && _d$payload.fold)) return d.children;
|
|
1408
|
-
}).nodeSize(node => {
|
|
1409
|
-
const [width, height] = node.data.state.size;
|
|
1410
|
-
return [height, width + (width ? paddingX * 2 : 0) + spacingHorizontal];
|
|
1411
|
-
}).spacing((a, b) => {
|
|
1412
|
-
return a.parent === b.parent ? spacingVertical : spacingVertical * 2;
|
|
1413
|
-
});
|
|
1414
|
-
const tree = layout.hierarchy(this.state.data);
|
|
1415
|
-
layout(tree);
|
|
1416
|
-
const descendants = tree.descendants().reverse();
|
|
1417
|
-
const links = tree.links();
|
|
1418
|
-
const linkShape = d3.linkHorizontal();
|
|
1419
|
-
const minX = d3.min(descendants, d => d.x - d.xSize / 2);
|
|
1420
|
-
const maxX = d3.max(descendants, d => d.x + d.xSize / 2);
|
|
1421
|
-
const minY = d3.min(descendants, d => d.y);
|
|
1422
|
-
const maxY = d3.max(descendants, d => d.y + d.ySize - spacingHorizontal);
|
|
1423
|
-
Object.assign(this.state, {
|
|
1424
|
-
minX,
|
|
1425
|
-
maxX,
|
|
1426
|
-
minY,
|
|
1427
|
-
maxY
|
|
1428
|
-
});
|
|
1429
|
-
if (autoFit) this.fit();
|
|
1430
|
-
const origin = originData && descendants.find(item => item.data === originData) || tree;
|
|
1431
|
-
const x0 = (_origin$data$state$x = origin.data.state.x0) != null ? _origin$data$state$x : origin.x;
|
|
1432
|
-
const y0 = (_origin$data$state$y = origin.data.state.y0) != null ? _origin$data$state$y : origin.y;
|
|
1433
|
-
|
|
1434
|
-
// Update the nodes
|
|
1435
|
-
const node = this.g.selectAll(childSelector('g')).data(descendants, d => d.data.state.key);
|
|
1436
|
-
const nodeEnter = node.enter().append('g').attr('data-depth', d => d.data.depth).attr('data-path', d => d.data.state.path).attr('transform', d => `translate(${y0 + origin.ySize - d.ySize},${x0 + origin.xSize / 2 - d.xSize})`);
|
|
1437
|
-
const nodeExit = this.transition(node.exit());
|
|
1438
|
-
nodeExit.select('line').attr('x1', d => d.ySize - spacingHorizontal).attr('x2', d => d.ySize - spacingHorizontal);
|
|
1439
|
-
nodeExit.select('foreignObject').style('opacity', 0);
|
|
1440
|
-
nodeExit.attr('transform', d => `translate(${origin.y + origin.ySize - d.ySize},${origin.x + origin.xSize / 2 - d.xSize})`).remove();
|
|
1441
|
-
const nodeMerge = node.merge(nodeEnter).attr('class', d => {
|
|
1442
|
-
var _d$data$payload;
|
|
1443
|
-
return ['markmap-node', ((_d$data$payload = d.data.payload) == null ? void 0 : _d$data$payload.fold) && 'markmap-fold'].filter(Boolean).join(' ');
|
|
1444
|
-
});
|
|
1445
|
-
this.transition(nodeMerge).attr('transform', d => `translate(${d.y},${d.x - d.xSize / 2})`);
|
|
1446
|
-
|
|
1447
|
-
// Update lines under the content
|
|
1448
|
-
const line = nodeMerge.selectAll(childSelector('line')).data(d => [d], d => d.data.state.key).join(enter => {
|
|
1449
|
-
return enter.append('line').attr('x1', d => d.ySize - spacingHorizontal).attr('x2', d => d.ySize - spacingHorizontal);
|
|
1450
|
-
}, update => update, exit => exit.remove());
|
|
1451
|
-
this.transition(line).attr('x1', -1).attr('x2', d => d.ySize - spacingHorizontal + 2).attr('y1', d => d.xSize).attr('y2', d => d.xSize).attr('stroke', d => color(d.data)).attr('stroke-width', linkWidth);
|
|
1452
|
-
|
|
1453
|
-
// Circle to link to children of the node
|
|
1454
|
-
const circle = nodeMerge.selectAll(childSelector('circle')).data(d => {
|
|
1455
|
-
var _d$data$children;
|
|
1456
|
-
return (_d$data$children = d.data.children) != null && _d$data$children.length ? [d] : [];
|
|
1457
|
-
}, d => d.data.state.key).join(enter => {
|
|
1458
|
-
return enter.append('circle').attr('stroke-width', '1.5').attr('cx', d => d.ySize - spacingHorizontal).attr('cy', d => d.xSize).attr('r', 0).on('click', (e, d) => this.handleClick(e, d)).on('mousedown', stopPropagation);
|
|
1459
|
-
}, update => update, exit => exit.remove());
|
|
1460
|
-
this.transition(circle).attr('r', 6).attr('cx', d => d.ySize - spacingHorizontal).attr('cy', d => d.xSize).attr('stroke', d => color(d.data)).attr('fill', d => {
|
|
1461
|
-
var _d$data$payload2;
|
|
1462
|
-
return (_d$data$payload2 = d.data.payload) != null && _d$data$payload2.fold && d.data.children ? color(d.data) : '#fff';
|
|
1463
|
-
});
|
|
1464
|
-
const foreignObject = nodeMerge.selectAll(childSelector('foreignObject')).data(d => [d], d => d.data.state.key).join(enter => {
|
|
1465
|
-
const fo = enter.append('foreignObject').attr('class', 'markmap-foreign').attr('x', paddingX).attr('y', 0).style('opacity', 0).on('mousedown', stopPropagation).on('dblclick', stopPropagation);
|
|
1466
|
-
fo.append('xhtml:div').select(function select(d) {
|
|
1467
|
-
const clone = d.data.state.el.cloneNode(true);
|
|
1468
|
-
this.replaceWith(clone);
|
|
1469
|
-
return clone;
|
|
1470
|
-
}).attr('xmlns', 'http://www.w3.org/1999/xhtml');
|
|
1471
|
-
return fo;
|
|
1472
|
-
}, update => update, exit => exit.remove()).attr('width', d => Math.max(0, d.ySize - spacingHorizontal - paddingX * 2)).attr('height', d => d.xSize);
|
|
1473
|
-
this.transition(foreignObject).style('opacity', 1);
|
|
1474
|
-
|
|
1475
|
-
// Update the links
|
|
1476
|
-
const path = this.g.selectAll(childSelector('path')).data(links, d => d.target.data.state.key).join(enter => {
|
|
1477
|
-
const source = [y0 + origin.ySize - spacingHorizontal, x0 + origin.xSize / 2];
|
|
1478
|
-
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({
|
|
1479
|
-
source,
|
|
1480
|
-
target: source
|
|
1481
|
-
}));
|
|
1482
|
-
}, update => update, exit => {
|
|
1483
|
-
const source = [origin.y + origin.ySize - spacingHorizontal, origin.x + origin.xSize / 2];
|
|
1484
|
-
return this.transition(exit).attr('d', linkShape({
|
|
1485
|
-
source,
|
|
1486
|
-
target: source
|
|
1487
|
-
})).remove();
|
|
1488
|
-
});
|
|
1489
|
-
this.transition(path).attr('stroke', d => color(d.target.data)).attr('stroke-width', d => linkWidth(d.target)).attr('d', d => {
|
|
1490
|
-
const origSource = d.source;
|
|
1491
|
-
const origTarget = d.target;
|
|
1492
|
-
const source = [origSource.y + origSource.ySize - spacingHorizontal, origSource.x + origSource.xSize / 2];
|
|
1493
|
-
const target = [origTarget.y, origTarget.x + origTarget.xSize / 2];
|
|
1494
|
-
return linkShape({
|
|
1495
|
-
source,
|
|
1496
|
-
target
|
|
1497
|
-
});
|
|
1498
|
-
});
|
|
1499
|
-
descendants.forEach(d => {
|
|
1500
|
-
d.data.state.x0 = d.x;
|
|
1501
|
-
d.data.state.y0 = d.y;
|
|
1502
|
-
});
|
|
1503
|
-
}
|
|
1504
|
-
transition(sel) {
|
|
1505
|
-
const {
|
|
1506
|
-
duration
|
|
1507
|
-
} = this.options;
|
|
1508
|
-
return sel.transition().duration(duration);
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
|
-
/**
|
|
1512
|
-
* Fit the content to the viewport.
|
|
1513
|
-
*/
|
|
1514
|
-
async fit() {
|
|
1515
|
-
const svgNode = this.svg.node();
|
|
1516
|
-
const {
|
|
1517
|
-
width: offsetWidth,
|
|
1518
|
-
height: offsetHeight
|
|
1519
|
-
} = svgNode.getBoundingClientRect();
|
|
1520
|
-
const {
|
|
1521
|
-
fitRatio
|
|
1522
|
-
} = this.options;
|
|
1523
|
-
const {
|
|
1524
|
-
minX,
|
|
1525
|
-
maxX,
|
|
1526
|
-
minY,
|
|
1527
|
-
maxY
|
|
1528
|
-
} = this.state;
|
|
1529
|
-
const naturalWidth = maxY - minY;
|
|
1530
|
-
const naturalHeight = maxX - minX;
|
|
1531
|
-
const scale = Math.min(offsetWidth / naturalWidth * fitRatio, offsetHeight / naturalHeight * fitRatio, 2);
|
|
1532
|
-
const initialZoom = d3.zoomIdentity.translate((offsetWidth - naturalWidth * scale) / 2 - minY * scale, (offsetHeight - naturalHeight * scale) / 2 - minX * scale).scale(scale);
|
|
1533
|
-
return this.transition(this.svg).call(this.zoom.transform, initialZoom).end().catch(noop);
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
/**
|
|
1537
|
-
* Pan the content to make the provided node visible in the viewport.
|
|
1538
|
-
*/
|
|
1539
|
-
async ensureView(node, padding) {
|
|
1540
|
-
let itemData;
|
|
1541
|
-
this.g.selectAll(childSelector('g')).each(function walk(d) {
|
|
1542
|
-
if (d.data === node) {
|
|
1543
|
-
itemData = d;
|
|
1544
|
-
}
|
|
1545
|
-
});
|
|
1546
|
-
if (!itemData) return;
|
|
1547
|
-
const svgNode = this.svg.node();
|
|
1548
|
-
const {
|
|
1549
|
-
spacingHorizontal
|
|
1550
|
-
} = this.options;
|
|
1551
|
-
const relRect = svgNode.getBoundingClientRect();
|
|
1552
|
-
const transform = d3.zoomTransform(svgNode);
|
|
1553
|
-
const [left, right] = [itemData.y, itemData.y + itemData.ySize - spacingHorizontal + 2].map(x => x * transform.k + transform.x);
|
|
1554
|
-
const [top, bottom] = [itemData.x - itemData.xSize / 2, itemData.x + itemData.xSize / 2].map(y => y * transform.k + transform.y);
|
|
1555
|
-
// Skip if the node includes or is included in the container.
|
|
1556
|
-
const pd = _extends({
|
|
1557
|
-
left: 0,
|
|
1558
|
-
right: 0,
|
|
1559
|
-
top: 0,
|
|
1560
|
-
bottom: 0
|
|
1561
|
-
}, padding);
|
|
1562
|
-
const dxs = [pd.left - left, relRect.width - pd.right - right];
|
|
1563
|
-
const dys = [pd.top - top, relRect.height - pd.bottom - bottom];
|
|
1564
|
-
const dx = dxs[0] * dxs[1] > 0 ? minBy(dxs, Math.abs) / transform.k : 0;
|
|
1565
|
-
const dy = dys[0] * dys[1] > 0 ? minBy(dys, Math.abs) / transform.k : 0;
|
|
1566
|
-
if (dx || dy) {
|
|
1567
|
-
const newTransform = transform.translate(dx, dy);
|
|
1568
|
-
return this.transition(this.svg).call(this.zoom.transform, newTransform).end().catch(noop);
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
/**
|
|
1573
|
-
* Scale content with it pinned at the center of the viewport.
|
|
1574
|
-
*/
|
|
1575
|
-
async rescale(scale) {
|
|
1576
|
-
const svgNode = this.svg.node();
|
|
1577
|
-
const {
|
|
1578
|
-
width: offsetWidth,
|
|
1579
|
-
height: offsetHeight
|
|
1580
|
-
} = svgNode.getBoundingClientRect();
|
|
1581
|
-
const halfWidth = offsetWidth / 2;
|
|
1582
|
-
const halfHeight = offsetHeight / 2;
|
|
1583
|
-
const transform = d3.zoomTransform(svgNode);
|
|
1584
|
-
const newTransform = transform.translate((halfWidth - transform.x) * (1 - scale) / transform.k, (halfHeight - transform.y) * (1 - scale) / transform.k).scale(scale);
|
|
1585
|
-
return this.transition(this.svg).call(this.zoom.transform, newTransform).end().catch(noop);
|
|
1586
|
-
}
|
|
1587
|
-
destroy() {
|
|
1588
|
-
this.svg.on('.zoom', null);
|
|
1589
|
-
this.svg.html(null);
|
|
1590
|
-
this.revokers.forEach(fn => {
|
|
1591
|
-
fn();
|
|
1592
|
-
});
|
|
1593
|
-
}
|
|
1594
|
-
static create(svg, opts, data = null) {
|
|
1595
|
-
const mm = new Markmap(svg, opts);
|
|
1596
|
-
if (data) {
|
|
1597
|
-
mm.setData(data);
|
|
1598
|
-
mm.fit(); // always fit for the first render
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
return mm;
|
|
1602
|
-
}
|
|
1603
|
-
}
|
|
1604
|
-
Markmap.defaultOptions = {
|
|
1605
|
-
autoFit: false,
|
|
1606
|
-
color: node => {
|
|
1607
|
-
var _node$state;
|
|
1608
|
-
return defaultColorFn(`${((_node$state = node.state) == null ? void 0 : _node$state.path) || ''}`);
|
|
1609
|
-
},
|
|
1610
|
-
duration: 500,
|
|
1611
|
-
embedGlobalCSS: true,
|
|
1612
|
-
fitRatio: 0.95,
|
|
1613
|
-
maxWidth: 0,
|
|
1614
|
-
nodeMinHeight: 16,
|
|
1615
|
-
paddingX: 8,
|
|
1616
|
-
scrollForPan: isMacintosh,
|
|
1617
|
-
spacingHorizontal: 80,
|
|
1618
|
-
spacingVertical: 5,
|
|
1619
|
-
initialExpandLevel: -1,
|
|
1620
|
-
zoom: true,
|
|
1621
|
-
pan: true,
|
|
1622
|
-
toggleRecursively: false
|
|
1623
|
-
};
|
|
1624
|
-
function deriveOptions(jsonOptions) {
|
|
1625
|
-
const derivedOptions = {};
|
|
1626
|
-
const options = _extends({}, jsonOptions);
|
|
1627
|
-
const {
|
|
1628
|
-
color,
|
|
1629
|
-
colorFreezeLevel
|
|
1630
|
-
} = options;
|
|
1631
|
-
if ((color == null ? void 0 : color.length) === 1) {
|
|
1632
|
-
const solidColor = color[0];
|
|
1633
|
-
derivedOptions.color = () => solidColor;
|
|
1634
|
-
} else if (color != null && color.length) {
|
|
1635
|
-
const colorFn = d3.scaleOrdinal(color);
|
|
1636
|
-
derivedOptions.color = node => colorFn(`${node.state.path}`);
|
|
1637
|
-
}
|
|
1638
|
-
if (colorFreezeLevel) {
|
|
1639
|
-
const color = derivedOptions.color || Markmap.defaultOptions.color;
|
|
1640
|
-
derivedOptions.color = node => {
|
|
1641
|
-
node = _extends({}, node, {
|
|
1642
|
-
state: _extends({}, node.state, {
|
|
1643
|
-
path: node.state.path.split('.').slice(0, colorFreezeLevel).join('.')
|
|
1644
|
-
})
|
|
1645
|
-
});
|
|
1646
|
-
return color(node);
|
|
1647
|
-
};
|
|
1648
|
-
}
|
|
1649
|
-
const numberKeys = ['duration', 'maxWidth', 'initialExpandLevel'];
|
|
1650
|
-
numberKeys.forEach(key => {
|
|
1651
|
-
const value = options[key];
|
|
1652
|
-
if (typeof value === 'number') derivedOptions[key] = value;
|
|
1653
|
-
});
|
|
1654
|
-
const booleanKeys = ['zoom', 'pan'];
|
|
1655
|
-
booleanKeys.forEach(key => {
|
|
1656
|
-
const value = options[key];
|
|
1657
|
-
if (value != null) derivedOptions[key] = !!value;
|
|
1658
|
-
});
|
|
1659
|
-
return derivedOptions;
|
|
1660
|
-
}
|
|
1661
|
-
|
|
1662
|
-
exports.Markmap = Markmap;
|
|
1663
|
-
exports.defaultColorFn = defaultColorFn;
|
|
1664
|
-
exports.deriveOptions = deriveOptions;
|
|
1665
|
-
exports.globalCSS = globalCSS;
|
|
1666
|
-
exports.loadCSS = loadCSS;
|
|
1667
|
-
exports.loadJS = loadJS;
|
|
1668
|
-
exports.refreshHook = refreshHook;
|
|
1669
|
-
|
|
1670
|
-
})(this.markmap = this.markmap || {}, d3);
|
|
1
|
+
(function(z,v){"use strict";class K{constructor(){this.listeners=[]}tap(e){return this.listeners.push(e),()=>this.revoke(e)}revoke(e){const n=this.listeners.indexOf(e);n>=0&&this.listeners.splice(n,1)}revokeAll(){this.listeners.splice(0)}call(...e){for(const n of this.listeners)n(...e)}}const pt=Math.random().toString(36).slice(2,8);let U=0;function gt(){return U+=1,`mm-${pt}-${U}`}function R(){}function _(t,e){const n=(i,o)=>e(i,()=>{var s;(s=i.children)==null||s.forEach(l=>{n(l,i)})},o);n(t)}function mt(t,...e){const n=(t||"").split(" ").filter(Boolean);return e.forEach(i=>{i&&n.indexOf(i)<0&&n.push(i)}),n.join(" ")}function w(t){if(typeof t=="string"){const n=t;t=i=>i.tagName===n}const e=t;return function(){let i=Array.from(this.childNodes);return e&&(i=i.filter(o=>e(o))),i}}function G(){const t={};return t.promise=new Promise((e,n)=>{t.resolve=e,t.reject=n}),t}function yt(t){const e={};return function(...i){const o=`${i[0]}`;let s=e[o];return s||(s={value:t(...i)},e[o]=s),s.value}}/*! @gera2ld/jsx-dom v2.2.2 | ISC License */const J=1,Z=2,xt="http://www.w3.org/2000/svg",L="http://www.w3.org/1999/xlink",St={show:L,actuate:L,href:L},vt=t=>typeof t=="string"||typeof t=="number",kt=t=>(t==null?void 0:t.vtype)===J,bt=t=>(t==null?void 0:t.vtype)===Z;function zt(t,e,...n){return e=Object.assign({},e,{children:n.length===1?n[0]:n}),wt(t,e)}function wt(t,e){let n;if(typeof t=="string")n=J;else if(typeof t=="function")n=Z;else throw new Error("Invalid VNode type");return{vtype:n,type:t,props:e}}function Et(t){return t.children}const Ct={isSvg:!1};function q(t,e){Array.isArray(e)||(e=[e]),e=e.filter(Boolean),e.length&&t.append(...e)}function Nt(t,e,n){for(const i in e)if(!(i==="key"||i==="children"||i==="ref"))if(i==="dangerouslySetInnerHTML")t.innerHTML=e[i].__html;else if(i==="innerHTML"||i==="textContent"||i==="innerText"||i==="value"&&["textarea","select"].includes(t.tagName)){const o=e[i];o!=null&&(t[i]=o)}else i.startsWith("on")?t[i.toLowerCase()]=e[i]:$t(t,i,e[i],n.isSvg)}const jt={className:"class",labelFor:"for"};function $t(t,e,n,i){if(e=jt[e]||e,n===!0)t.setAttribute(e,"");else if(n===!1)t.removeAttribute(e);else{const o=i?St[e]:void 0;o!==void 0?t.setAttributeNS(o,e,n):t.setAttribute(e,n)}}function Tt(t){return t.reduce((e,n)=>e.concat(n),[])}function D(t,e){return Array.isArray(t)?Tt(t.map(n=>D(n,e))):F(t,e)}function F(t,e=Ct){if(t==null||typeof t=="boolean")return null;if(t instanceof Node)return t;if(bt(t)){const{type:n,props:i}=t;if(n===Et){const s=document.createDocumentFragment();if(i.children){const l=D(i.children,e);q(s,l)}return s}const o=n(i);return F(o,e)}if(vt(t))return document.createTextNode(`${t}`);if(kt(t)){let n;const{type:i,props:o}=t;if(!e.isSvg&&i==="svg"&&(e=Object.assign({},e,{isSvg:!0})),e.isSvg?n=document.createElementNS(xt,i):n=document.createElement(i),Nt(n,o,e),o.children){let l=e;e.isSvg&&i==="foreignObject"&&(l=Object.assign({},l,{isSvg:!1}));const a=D(o.children,l);a!=null&&q(n,a)}const{ref:s}=o;return typeof s=="function"&&s(n),n}throw new Error("mount: Invalid Vnode!")}function Xt(t){return F(t)}function j(...t){return Xt(zt(...t))}const At=yt(t=>{document.head.append(j("link",{rel:"preload",as:"script",href:t}))}),Q={},tt={};async function Mt(t,e){var n;const i=t.type==="script"&&((n=t.data)==null?void 0:n.src)||"";if(t.loaded||(t.loaded=Q[i]),!t.loaded){const o=G();if(t.loaded=o.promise,t.type==="script"&&(document.head.append(j("script",{...t.data,onLoad:()=>o.resolve(),onError:o.reject})),i?Q[i]=t.loaded:o.resolve()),t.type==="iife"){const{fn:s,getParams:l}=t.data;s(...(l==null?void 0:l(e))||[]),o.resolve()}}await t.loaded}async function Ot(t){const e=t.type==="stylesheet"&&t.data.href||"";if(t.loaded||(t.loaded=tt[e]),!t.loaded){const n=G();t.loaded=n.promise,e&&(tt[e]=t.loaded),t.type==="style"?(document.head.append(j("style",{textContent:t.data})),n.resolve()):e&&(document.head.append(j("link",{rel:"stylesheet",...t.data})),fetch(e).then(i=>{if(i.ok)return i.text();throw i}).then(()=>n.resolve(),n.reject))}await t.loaded}async function Rt(t,e){t.forEach(n=>{var i;n.type==="script"&&((i=n.data)!=null&&i.src)&&At(n.data.src)}),e={getMarkmap:()=>window.markmap,...e};for(const n of t)await Mt(n,e)}async function _t(t){await Promise.all(t.map(e=>Ot(e)))}/*! @gera2ld/jsx-dom v2.2.2 | ISC License */const et=1,nt=2,Lt="http://www.w3.org/2000/svg",H="http://www.w3.org/1999/xlink",Dt={show:H,actuate:H,href:H},Ft=t=>typeof t=="string"||typeof t=="number",Ht=t=>(t==null?void 0:t.vtype)===et,Bt=t=>(t==null?void 0:t.vtype)===nt;function $(t,e){let n;if(typeof t=="string")n=et;else if(typeof t=="function")n=nt;else throw new Error("Invalid VNode type");return{vtype:n,type:t,props:e}}function It(t){return t.children}const Vt={isSvg:!1};function it(t,e){Array.isArray(e)||(e=[e]),e=e.filter(Boolean),e.length&&t.append(...e)}function Pt(t,e,n){for(const i in e)if(!(i==="key"||i==="children"||i==="ref"))if(i==="dangerouslySetInnerHTML")t.innerHTML=e[i].__html;else if(i==="innerHTML"||i==="textContent"||i==="innerText"||i==="value"&&["textarea","select"].includes(t.tagName)){const o=e[i];o!=null&&(t[i]=o)}else i.startsWith("on")?t[i.toLowerCase()]=e[i]:Yt(t,i,e[i],n.isSvg)}const Wt={className:"class",labelFor:"for"};function Yt(t,e,n,i){if(e=Wt[e]||e,n===!0)t.setAttribute(e,"");else if(n===!1)t.removeAttribute(e);else{const o=i?Dt[e]:void 0;o!==void 0?t.setAttributeNS(o,e,n):t.setAttribute(e,n)}}function Kt(t){return t.reduce((e,n)=>e.concat(n),[])}function B(t,e){return Array.isArray(t)?Kt(t.map(n=>B(n,e))):I(t,e)}function I(t,e=Vt){if(t==null||typeof t=="boolean")return null;if(t instanceof Node)return t;if(Bt(t)){const{type:n,props:i}=t;if(n===It){const s=document.createDocumentFragment();if(i.children){const l=B(i.children,e);it(s,l)}return s}const o=n(i);return I(o,e)}if(Ft(t))return document.createTextNode(`${t}`);if(Ht(t)){let n;const{type:i,props:o}=t;if(!e.isSvg&&i==="svg"&&(e=Object.assign({},e,{isSvg:!0})),e.isSvg?n=document.createElementNS(Lt,i):n=document.createElement(i),Pt(n,o,e),o.children){let l=e;e.isSvg&&i==="foreignObject"&&(l=Object.assign({},l,{isSvg:!1}));const a=B(o.children,l);a!=null&&it(n,a)}const{ref:s}=o;return typeof s=="function"&&s(n),n}throw new Error("mount: Invalid Vnode!")}function V(t){return I(t)}function Ut(t){var e=0,n=t.children,i=n&&n.length;if(!i)e=1;else for(;--i>=0;)e+=n[i].value;t.value=e}function Gt(){return this.eachAfter(Ut)}function Jt(t){var e=this,n,i=[e],o,s,l;do for(n=i.reverse(),i=[];e=n.pop();)if(t(e),o=e.children,o)for(s=0,l=o.length;s<l;++s)i.push(o[s]);while(i.length);return this}function Zt(t){for(var e=this,n=[e],i,o;e=n.pop();)if(t(e),i=e.children,i)for(o=i.length-1;o>=0;--o)n.push(i[o]);return this}function qt(t){for(var e=this,n=[e],i=[],o,s,l;e=n.pop();)if(i.push(e),o=e.children,o)for(s=0,l=o.length;s<l;++s)n.push(o[s]);for(;e=i.pop();)t(e);return this}function Qt(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,i=e.children,o=i&&i.length;--o>=0;)n+=i[o].value;e.value=n})}function te(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function ee(t){for(var e=this,n=ne(e,t),i=[e];e!==n;)e=e.parent,i.push(e);for(var o=i.length;t!==n;)i.splice(o,0,t),t=t.parent;return i}function ne(t,e){if(t===e)return t;var n=t.ancestors(),i=e.ancestors(),o=null;for(t=n.pop(),e=i.pop();t===e;)o=t,t=n.pop(),e=i.pop();return o}function ie(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function oe(){var t=[];return this.each(function(e){t.push(e)}),t}function re(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function se(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}function P(t,e){var n=new T(t),i=+t.value&&(n.value=t.value),o,s=[n],l,a,c,p;for(e==null&&(e=le);o=s.pop();)if(i&&(o.value=+o.data.value),(a=e(o.data))&&(p=a.length))for(o.children=new Array(p),c=p-1;c>=0;--c)s.push(l=o.children[c]=new T(a[c])),l.parent=o,l.depth=o.depth+1;return n.eachBefore(he)}function ae(){return P(this).eachBefore(ce)}function le(t){return t.children}function ce(t){t.data=t.data.data}function he(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function T(t){this.data=t,this.depth=this.height=0,this.parent=null}T.prototype=P.prototype={constructor:T,count:Gt,each:Jt,eachAfter:qt,eachBefore:Zt,sum:Qt,sort:te,path:ee,ancestors:ie,descendants:oe,leaves:re,links:se,copy:ae};const de={name:"d3-flextree",version:"2.1.2",main:"build/d3-flextree.js",module:"index","jsnext:main":"index",author:{name:"Chris Maloney",url:"http://chrismaloney.org"},description:"Flexible tree layout algorithm that allows for variable node sizes.",keywords:["d3","d3-module","layout","tree","hierarchy","d3-hierarchy","plugin","d3-plugin","infovis","visualization","2d"],homepage:"https://github.com/klortho/d3-flextree",license:"WTFPL",repository:{type:"git",url:"https://github.com/klortho/d3-flextree.git"},scripts:{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"},dependencies:{"d3-hierarchy":"^1.1.5"},devDependencies:{"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"}},{version:ue}=de,fe=Object.freeze({children:t=>t.children,nodeSize:t=>t.data.size,spacing:0});function ot(t){const e=Object.assign({},fe,t);function n(a){const c=e[a];return typeof c=="function"?c:()=>c}function i(a){const c=l(s(),a,p=>p.children);return c.update(),c.data}function o(){const a=n("nodeSize"),c=n("spacing");return class ft extends P.prototype.constructor{constructor(h){super(h)}copy(){const h=l(this.constructor,this,f=>f.children);return h.each(f=>f.data=f.data.data),h}get size(){return a(this)}spacing(h){return c(this,h)}get nodes(){return this.descendants()}get xSize(){return this.size[0]}get ySize(){return this.size[1]}get top(){return this.y}get bottom(){return this.y+this.ySize}get left(){return this.x-this.xSize/2}get right(){return this.x+this.xSize/2}get root(){const h=this.ancestors();return h[h.length-1]}get numChildren(){return this.hasChildren?this.children.length:0}get hasChildren(){return!this.noChildren}get noChildren(){return this.children===null}get firstChild(){return this.hasChildren?this.children[0]:null}get lastChild(){return this.hasChildren?this.children[this.numChildren-1]:null}get extents(){return(this.children||[]).reduce((h,f)=>ft.maxExtents(h,f.extents),this.nodeExtents)}get nodeExtents(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}static maxExtents(h,f){return{top:Math.min(h.top,f.top),bottom:Math.max(h.bottom,f.bottom),left:Math.min(h.left,f.left),right:Math.max(h.right,f.right)}}}}function s(){const a=o(),c=n("nodeSize"),p=n("spacing");return class extends a{constructor(h){super(h),Object.assign(this,{x:0,y:0,relX:0,prelim:0,shift:0,change:0,lExt:this,lExtRelX:0,lThr:null,rExt:this,rExtRelX:0,rThr:null})}get size(){return c(this.data)}spacing(h){return p(this.data,h.data)}get x(){return this.data.x}set x(h){this.data.x=h}get y(){return this.data.y}set y(h){this.data.y=h}update(){return rt(this),st(this),this}}}function l(a,c,p){const h=(f,m)=>{const d=new a(f);Object.assign(d,{parent:m,depth:m===null?0:m.depth+1,height:0,length:1});const S=p(f)||[];return d.children=S.length===0?null:S.map(y=>h(y,d)),d.children&&Object.assign(d,d.children.reduce((y,g)=>({height:Math.max(y.height,g.height+1),length:y.length+g.length}),d)),d};return h(c,null)}return Object.assign(i,{nodeSize(a){return arguments.length?(e.nodeSize=a,i):e.nodeSize},spacing(a){return arguments.length?(e.spacing=a,i):e.spacing},children(a){return arguments.length?(e.children=a,i):e.children},hierarchy(a,c){const p=typeof c>"u"?e.children:c;return l(o(),a,p)},dump(a){const c=n("nodeSize"),p=h=>f=>{const m=h+" ",d=h+" ",{x:S,y}=f,g=c(f),x=f.children||[],k=x.length===0?" ":`,${m}children: [${d}${x.map(p(d)).join(d)}${m}],${h}`;return`{ size: [${g.join(", ")}],${m}x: ${S}, y: ${y}${k}},`};return p(`
|
|
2
|
+
`)(a)}}),i}ot.version=ue;const rt=(t,e=0)=>(t.y=e,(t.children||[]).reduce((n,i)=>{const[o,s]=n;rt(i,t.y+t.ySize);const l=(o===0?i.lExt:i.rExt).bottom;o!==0&&ge(t,o,s);const a=ze(l,o,s);return[o+1,a]},[0,null]),pe(t),be(t),t),st=(t,e,n)=>{typeof e>"u"&&(e=-t.relX-t.prelim,n=0);const i=e+t.relX;return t.relX=i+t.prelim-n,t.prelim=0,t.x=n+t.relX,(t.children||[]).forEach(o=>st(o,i,t.x)),t},pe=t=>{(t.children||[]).reduce((e,n)=>{const[i,o]=e,s=i+n.shift,l=o+s+n.change;return n.relX+=l,[s,l]},[0,0])},ge=(t,e,n)=>{const i=t.children[e-1],o=t.children[e];let s=i,l=i.relX,a=o,c=o.relX,p=!0;for(;s&&a;){s.bottom>n.lowY&&(n=n.next);const h=l+s.prelim-(c+a.prelim)+s.xSize/2+a.xSize/2+s.spacing(a);(h>0||h<0&&p)&&(c+=h,me(o,h),ye(t,e,n.index,h)),p=!1;const f=s.bottom,m=a.bottom;f<=m&&(s=Se(s),s&&(l+=s.relX)),f>=m&&(a=xe(a),a&&(c+=a.relX))}!s&&a?ve(t,e,a,c):s&&!a&&ke(t,e,s,l)},me=(t,e)=>{t.relX+=e,t.lExtRelX+=e,t.rExtRelX+=e},ye=(t,e,n,i)=>{const o=t.children[e],s=e-n;if(s>1){const l=i/s;t.children[n+1].shift+=l,o.shift-=l,o.change-=i-l}},xe=t=>t.hasChildren?t.firstChild:t.lThr,Se=t=>t.hasChildren?t.lastChild:t.rThr,ve=(t,e,n,i)=>{const o=t.firstChild,s=o.lExt,l=t.children[e];s.lThr=n;const a=i-n.relX-o.lExtRelX;s.relX+=a,s.prelim-=a,o.lExt=l.lExt,o.lExtRelX=l.lExtRelX},ke=(t,e,n,i)=>{const o=t.children[e],s=o.rExt,l=t.children[e-1];s.rThr=n;const a=i-n.relX-o.rExtRelX;s.relX+=a,s.prelim-=a,o.rExt=l.rExt,o.rExtRelX=l.rExtRelX},be=t=>{if(t.hasChildren){const e=t.firstChild,n=t.lastChild,i=(e.prelim+e.relX-e.xSize/2+n.relX+n.prelim+n.xSize/2)/2;Object.assign(t,{prelim:i,lExt:e.lExt,lExtRelX:e.lExtRelX,rExt:n.rExt,rExtRelX:n.rExtRelX})}},ze=(t,e,n)=>{for(;n!==null&&t>=n.lowY;)n=n.next;return{lowY:t,index:e,next:n}},at=".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{padding:.25em;font-size:calc(1em - 2px);color:#555;background-color:#f0f0f0;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:#ffeaa7}",we=".markmap-container{position:absolute;width:0;height:0;top:-100px;left:-100px;overflow:hidden}.markmap-container>.markmap-foreign{display:inline-block}.markmap-container>.markmap-foreign>div:last-child,.markmap-container>.markmap-foreign>div:last-child :not(pre){white-space:nowrap}.markmap-container>.markmap-foreign>div:last-child code{white-space:inherit}",Ee=at;function lt(t){const e=t.data;return Math.max(4-2*e.depth,1.5)}function ct(t,e){const n=v.minIndex(t,e);return t[n]}function W(t){t.stopPropagation()}function Ce(){return{transformHtml:new K}}const ht=new K,dt=v.scaleOrdinal(v.schemeCategory10),ut=typeof navigator<"u"&&navigator.userAgent.includes("Macintosh"),C=class C{constructor(e,n){this.options=C.defaultOptions,this.revokers=[],this.handleZoom=i=>{const{transform:o}=i;this.g.attr("transform",o)},this.handlePan=i=>{i.preventDefault();const o=v.zoomTransform(this.svg.node()),s=o.translate(-i.deltaX/o.k,-i.deltaY/o.k);this.svg.call(this.zoom.transform,s)},this.handleClick=(i,o)=>{let s=this.options.toggleRecursively;(ut?i.metaKey:i.ctrlKey)&&(s=!s),this.toggleNode(o.data,s)},this.viewHooks=Ce(),this.svg=e.datum?e:v.select(e),this.styleNode=this.svg.append("style"),this.zoom=v.zoom().filter(i=>this.options.scrollForPan&&i.type==="wheel"?i.ctrlKey&&!i.button:(!i.ctrlKey||i.type==="wheel")&&!i.button).on("zoom",this.handleZoom),this.setOptions(n),this.state={id:this.options.id||this.svg.attr("id")||gt(),minX:0,maxX:0,minY:0,maxY:0},this.g=this.svg.append("g"),this.revokers.push(ht.tap(()=>{this.setData()}))}getStyleContent(){const{style:e}=this.options,{id:n}=this.state,i=typeof e=="function"?e(n):"";return[this.options.embedGlobalCSS&&at,i].filter(Boolean).join(`
|
|
3
|
+
`)}updateStyle(){this.svg.attr("class",mt(this.svg.attr("class"),"markmap",this.state.id));const e=this.getStyleContent();this.styleNode.text(e)}toggleNode(e,n=!1){var o,s;const i=(o=e.payload)!=null&&o.fold?0:1;n?_(e,(l,a)=>{l.payload={...l.payload,fold:i},a()}):e.payload={...e.payload,fold:(s=e.payload)!=null&&s.fold?0:1},this.renderData(e)}initializeData(e){let n=0;const{color:i,nodeMinHeight:o,maxWidth:s,initialExpandLevel:l}=this.options,{id:a}=this.state,c=V($("div",{className:`markmap-container markmap ${a}-g`})),p=V($("style",{children:[this.getStyleContent(),we].join(`
|
|
4
|
+
`)}));document.body.append(c,p);const h=s?`max-width: ${s}px`:"";let f=0;_(e,(d,S,y)=>{var k,E,A;d.children=(k=d.children)==null?void 0:k.map(N=>({...N})),n+=1;const g=V($("div",{className:"markmap-foreign",style:h,children:$("div",{dangerouslySetInnerHTML:{__html:d.content}})}));c.append(g),d.state={...d.state,id:n,el:g.firstChild},d.state.path=[(E=y==null?void 0:y.state)==null?void 0:E.path,d.state.id].filter(Boolean).join("."),i(d);const x=((A=d.payload)==null?void 0:A.fold)===2;x?f+=1:(f||l>=0&&d.depth>=l)&&(d.payload={...d.payload,fold:1}),S(),x&&(f-=1)});const m=Array.from(c.childNodes).map(d=>d.firstChild);this.viewHooks.transformHtml.call(this,m),m.forEach(d=>{var S;(S=d.parentNode)==null||S.append(d.cloneNode(!0))}),_(e,(d,S,y)=>{var k;const g=d.state,x=g.el.getBoundingClientRect();d.content=g.el.innerHTML,g.size=[Math.ceil(x.width)+1,Math.max(Math.ceil(x.height),o)],g.key=[(k=y==null?void 0:y.state)==null?void 0:k.id,g.id].filter(Boolean).join(".")+d.content,S()}),c.remove(),p.remove()}setOptions(e){this.options={...this.options,...e},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)}setData(e,n){n&&this.setOptions(n),e&&(this.state.data=e),this.state.data&&(this.initializeData(this.state.data),this.updateStyle(),this.renderData())}renderData(e){if(!this.state.data)return;const{spacingHorizontal:n,paddingX:i,spacingVertical:o,autoFit:s,color:l}=this.options,a=ot({}).children(r=>{var u;if(!((u=r.payload)!=null&&u.fold))return r.children}).nodeSize(r=>{const[u,b]=r.data.state.size;return[b,u+(u?i*2:0)+n]}).spacing((r,u)=>r.parent===u.parent?o:o*2),c=a.hierarchy(this.state.data);a(c);const p=c.descendants().reverse(),h=c.links(),f=v.linkHorizontal(),m=v.min(p,r=>r.x-r.xSize/2),d=v.max(p,r=>r.x+r.xSize/2),S=v.min(p,r=>r.y),y=v.max(p,r=>r.y+r.ySize-n);Object.assign(this.state,{minX:m,maxX:d,minY:S,maxY:y}),s&&this.fit();const g=e&&p.find(r=>r.data===e)||c,x=g.data.state.x0??g.x,k=g.data.state.y0??g.y,E=this.g.selectAll(w("g")).data(p,r=>r.data.state.key),A=E.enter().append("g").attr("data-depth",r=>r.data.depth).attr("data-path",r=>r.data.state.path).attr("transform",r=>`translate(${k+g.ySize-r.ySize},${x+g.xSize/2-r.xSize})`),N=this.transition(E.exit());N.select("line").attr("x1",r=>r.ySize-n).attr("x2",r=>r.ySize-n),N.select("foreignObject").style("opacity",0),N.attr("transform",r=>`translate(${g.y+g.ySize-r.ySize},${g.x+g.xSize/2-r.xSize})`).remove();const M=E.merge(A).attr("class",r=>{var u;return["markmap-node",((u=r.data.payload)==null?void 0:u.fold)&&"markmap-fold"].filter(Boolean).join(" ")});this.transition(M).attr("transform",r=>`translate(${r.y},${r.x-r.xSize/2})`);const je=M.selectAll(w("line")).data(r=>[r],r=>r.data.state.key).join(r=>r.append("line").attr("x1",u=>u.ySize-n).attr("x2",u=>u.ySize-n),r=>r,r=>r.remove());this.transition(je).attr("x1",-1).attr("x2",r=>r.ySize-n+2).attr("y1",r=>r.xSize).attr("y2",r=>r.xSize).attr("stroke",r=>l(r.data)).attr("stroke-width",lt);const $e=M.selectAll(w("circle")).data(r=>{var u;return(u=r.data.children)!=null&&u.length?[r]:[]},r=>r.data.state.key).join(r=>r.append("circle").attr("stroke-width","1.5").attr("cx",u=>u.ySize-n).attr("cy",u=>u.xSize).attr("r",0).on("click",(u,b)=>this.handleClick(u,b)).on("mousedown",W),r=>r,r=>r.remove());this.transition($e).attr("r",6).attr("cx",r=>r.ySize-n).attr("cy",r=>r.xSize).attr("stroke",r=>l(r.data)).attr("fill",r=>{var u;return(u=r.data.payload)!=null&&u.fold&&r.data.children?l(r.data):"#fff"});const Te=M.selectAll(w("foreignObject")).data(r=>[r],r=>r.data.state.key).join(r=>{const u=r.append("foreignObject").attr("class","markmap-foreign").attr("x",i).attr("y",0).style("opacity",0).on("mousedown",W).on("dblclick",W);return u.append("xhtml:div").select(function(Y){const O=Y.data.state.el.cloneNode(!0);return this.replaceWith(O),O}).attr("xmlns","http://www.w3.org/1999/xhtml"),u},r=>r,r=>r.remove()).attr("width",r=>Math.max(0,r.ySize-n-i*2)).attr("height",r=>r.xSize);this.transition(Te).style("opacity",1);const Xe=this.g.selectAll(w("path")).data(h,r=>r.target.data.state.key).join(r=>{const u=[k+g.ySize-n,x+g.xSize/2];return r.insert("path","g").attr("class","markmap-link").attr("data-depth",b=>b.target.data.depth).attr("data-path",b=>b.target.data.state.path).attr("d",f({source:u,target:u}))},r=>r,r=>{const u=[g.y+g.ySize-n,g.x+g.xSize/2];return this.transition(r).attr("d",f({source:u,target:u})).remove()});this.transition(Xe).attr("stroke",r=>l(r.target.data)).attr("stroke-width",r=>lt(r.target)).attr("d",r=>{const u=r.source,b=r.target,Y=[u.y+u.ySize-n,u.x+u.xSize/2],O=[b.y,b.x+b.xSize/2];return f({source:Y,target:O})}),p.forEach(r=>{r.data.state.x0=r.x,r.data.state.y0=r.y})}transition(e){const{duration:n}=this.options;return e.transition().duration(n)}async fit(){const e=this.svg.node(),{width:n,height:i}=e.getBoundingClientRect(),{fitRatio:o}=this.options,{minX:s,maxX:l,minY:a,maxY:c}=this.state,p=c-a,h=l-s,f=Math.min(n/p*o,i/h*o,2),m=v.zoomIdentity.translate((n-p*f)/2-a*f,(i-h*f)/2-s*f).scale(f);return this.transition(this.svg).call(this.zoom.transform,m).end().catch(R)}async ensureView(e,n){let i;if(this.g.selectAll(w("g")).each(function(k){k.data===e&&(i=k)}),!i)return;const o=this.svg.node(),{spacingHorizontal:s}=this.options,l=o.getBoundingClientRect(),a=v.zoomTransform(o),[c,p]=[i.y,i.y+i.ySize-s+2].map(x=>x*a.k+a.x),[h,f]=[i.x-i.xSize/2,i.x+i.xSize/2].map(x=>x*a.k+a.y),m={left:0,right:0,top:0,bottom:0,...n},d=[m.left-c,l.width-m.right-p],S=[m.top-h,l.height-m.bottom-f],y=d[0]*d[1]>0?ct(d,Math.abs)/a.k:0,g=S[0]*S[1]>0?ct(S,Math.abs)/a.k:0;if(y||g){const x=a.translate(y,g);return this.transition(this.svg).call(this.zoom.transform,x).end().catch(R)}}async rescale(e){const n=this.svg.node(),{width:i,height:o}=n.getBoundingClientRect(),s=i/2,l=o/2,a=v.zoomTransform(n),c=a.translate((s-a.x)*(1-e)/a.k,(l-a.y)*(1-e)/a.k).scale(e);return this.transition(this.svg).call(this.zoom.transform,c).end().catch(R)}destroy(){this.svg.on(".zoom",null),this.svg.html(null),this.revokers.forEach(e=>{e()})}static create(e,n,i=null){const o=new C(e,n);return i&&(o.setData(i),o.fit()),o}};C.defaultOptions={autoFit:!1,color:e=>{var n;return dt(`${((n=e.state)==null?void 0:n.path)||""}`)},duration:500,embedGlobalCSS:!0,fitRatio:.95,maxWidth:0,nodeMinHeight:16,paddingX:8,scrollForPan:ut,spacingHorizontal:80,spacingVertical:5,initialExpandLevel:-1,zoom:!0,pan:!0,toggleRecursively:!1};let X=C;function Ne(t){const e={},n={...t},{color:i,colorFreezeLevel:o}=n;if((i==null?void 0:i.length)===1){const a=i[0];e.color=()=>a}else if(i!=null&&i.length){const a=v.scaleOrdinal(i);e.color=c=>a(`${c.state.path}`)}if(o){const a=e.color||X.defaultOptions.color;e.color=c=>(c={...c,state:{...c.state,path:c.state.path.split(".").slice(0,o).join(".")}},a(c))}return["duration","maxWidth","initialExpandLevel"].forEach(a=>{const c=n[a];typeof c=="number"&&(e[a]=c)}),["zoom","pan"].forEach(a=>{const c=n[a];c!=null&&(e[a]=!!c)}),e}z.Markmap=X,z.defaultColorFn=dt,z.deriveOptions=Ne,z.globalCSS=Ee,z.loadCSS=_t,z.loadJS=Rt,z.refreshHook=ht,Object.defineProperty(z,Symbol.toStringTag,{value:"Module"})})(this.markmap=this.markmap||{},d3);
|