phylotree 2.2.1 → 2.4.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/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "phylotree",
3
- "version": "2.2.1",
3
+ "version": "2.4.0",
4
4
  "main": "dist/phylotree.js",
5
+ "types": "dist/phylotree.d.ts",
5
6
  "unpkg": "dist/phylotree.js",
6
7
  "jsdelivr": "dist/phylotree.js",
7
8
  "module": "src/index.js",
@@ -22,41 +23,37 @@
22
23
  "index.html"
23
24
  ],
24
25
  "dependencies": {
25
- "commander": "^6.2.1",
26
- "csv-stringify": "^5.3.6",
26
+ "commander": "^14.0.0",
27
+ "csv-stringify": "^6.6.0",
27
28
  "d3": "^7.9.0",
28
29
  "fast-xml-parser": "^5.2.5",
29
- "jquery": "3",
30
- "lodash": "^4.17.11",
31
- "moment": "^2.29.4",
30
+ "jquery": "^3.7.1",
31
+ "lodash": "^4.17.21",
32
+ "moment": "^2.30.1",
32
33
  "pretty-data": "^0.40.0",
33
- "rollup-plugin-node-resolve": "^5.2.0",
34
- "underscore": "1.x",
35
- "winston": "^3.2.1"
34
+ "underscore": "^1.13.7",
35
+ "winston": "^3.17.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@rollup/plugin-commonjs": "^28.0.6",
38
+ "@rollup/plugin-commonjs": "^29.0.0",
39
39
  "@rollup/plugin-node-resolve": "^16.0.1",
40
- "concurrently": "^6.2.0",
41
- "eslint": "^7.32.0",
40
+ "@rollup/plugin-terser": "^0.4.4",
41
+ "concurrently": "^9.2.0",
42
+ "@eslint/js": "^9.39.0",
43
+ "eslint": "^9.39.0",
44
+ "globals": "^16.2.0",
42
45
  "http-server": "^14.1.1",
43
- "jsdoc-to-markdown": "^7.0.1",
44
- "prettier": "^2.3.2",
45
- "rollup": "^2.50.6",
46
- "rollup-plugin-copy": "^3.3.0",
47
- "rollup-plugin-execute": "^1.1.1",
48
- "rollup-plugin-terser": "^7.0.2",
49
- "rollup-watch": "^3.2.2",
50
- "tape": "5.2.2",
51
- "tape-watch": "^2.3.0",
52
- "yarn": "^1.22.11"
46
+ "jsdoc-to-markdown": "^9.1.0",
47
+ "prettier": "^3.7.0",
48
+ "rollup": "^4.40.0",
49
+ "rollup-plugin-copy": "^3.5.0",
50
+ "tape": "^5.9.0"
53
51
  },
54
52
  "scripts": {
55
- "lint": "eslint --ext .js --ignore-pattern data,docs,images,node_modules ./",
56
- "dev": "rollup -w -c rollup.config.js",
57
- "serve": "concurrently 'rollup -w -c rollup.config.js' 'http-server'",
58
- "build": "rollup -c rollup.config.js",
59
- "watch": "tape-watch -r source-map-support/register test/*-test.js",
53
+ "lint": "eslint .",
54
+ "dev": "rollup -w -c rollup.config.mjs",
55
+ "serve": "concurrently 'rollup -w -c rollup.config.mjs' 'http-server'",
56
+ "build": "rollup -c rollup.config.mjs",
60
57
  "test": "tape -r source-map-support/register 'test/*-test.js'",
61
58
  "docs:generate": "jsdoc2md 'src/**/*.js' > API.md",
62
59
  "docs:validate": "jsdoc2md 'src/**/*.js' --no-cache --partial 'partials/**/*.hbs'",
@@ -67,6 +64,7 @@
67
64
  "dist/phylotree.css",
68
65
  "dist/phylotree.js",
69
66
  "dist/phylotree.min.js",
67
+ "dist/phylotree.d.ts",
70
68
  "bin",
71
69
  "src"
72
70
  ]
@@ -1,47 +1,47 @@
1
- import { XMLParser } from 'fast-xml-parser';
1
+ import { XMLParser } from "fast-xml-parser";
2
2
 
3
3
  // Changes XML to JSON
4
4
  // Modified version from here: http://davidwalsh.name/convert-xml-json
5
5
  function xmlToJson(xml) {
6
6
 
7
- // Create the return object
8
- var obj = {};
7
+ // Create the return object
8
+ var obj = {};
9
9
 
10
- if (xml.nodeType == 1) { // element
11
- // do attributes
12
- if (xml.attributes.length > 0) {
13
- obj["@attributes"] = {};
14
- for (var j = 0; j < xml.attributes.length; j++) {
15
- var attribute = xml.attributes.item(j);
16
- obj["@attributes"][attribute.nodeName] = attribute.nodeValue;
17
- }
18
- }
19
- } else if (xml.nodeType == 3) { // text
20
- obj = xml.nodeValue;
21
- }
10
+ if (xml.nodeType == 1) { // element
11
+ // do attributes
12
+ if (xml.attributes.length > 0) {
13
+ obj["@attributes"] = {};
14
+ for (var j = 0; j < xml.attributes.length; j++) {
15
+ var attribute = xml.attributes.item(j);
16
+ obj["@attributes"][attribute.nodeName] = attribute.nodeValue;
17
+ }
18
+ }
19
+ } else if (xml.nodeType == 3) { // text
20
+ obj = xml.nodeValue;
21
+ }
22
22
 
23
- // do children
24
- // If just one text node inside
25
- if (xml.hasChildNodes() && xml.childNodes.length === 1 && xml.childNodes[0].nodeType === 3) {
26
- obj = xml.childNodes[0].nodeValue;
27
- }
28
- else if (xml.hasChildNodes()) {
29
- for(var i = 0; i < xml.childNodes.length; i++) {
30
- var item = xml.childNodes.item(i);
31
- var nodeName = item.nodeName;
32
- if (typeof(obj[nodeName]) == "undefined") {
33
- obj[nodeName] = xmlToJson(item);
34
- } else {
35
- if (typeof(obj[nodeName].push) == "undefined") {
36
- var old = obj[nodeName];
37
- obj[nodeName] = [];
38
- obj[nodeName].push(old);
39
- }
40
- obj[nodeName].push(xmlToJson(item));
41
- }
42
- }
43
- }
44
- return obj;
23
+ // do children
24
+ // If just one text node inside
25
+ if (xml.hasChildNodes() && xml.childNodes.length === 1 && xml.childNodes[0].nodeType === 3) {
26
+ obj = xml.childNodes[0].nodeValue;
27
+ }
28
+ else if (xml.hasChildNodes()) {
29
+ for(var i = 0; i < xml.childNodes.length; i++) {
30
+ var item = xml.childNodes.item(i);
31
+ var nodeName = item.nodeName;
32
+ if (typeof(obj[nodeName]) == "undefined") {
33
+ obj[nodeName] = xmlToJson(item);
34
+ } else {
35
+ if (typeof(obj[nodeName].push) == "undefined") {
36
+ var old = obj[nodeName];
37
+ obj[nodeName] = [];
38
+ obj[nodeName].push(old);
39
+ }
40
+ obj[nodeName].push(xmlToJson(item));
41
+ }
42
+ }
43
+ }
44
+ return obj;
45
45
  }
46
46
 
47
47
  var phyloxml_parser = function(xml, options) {
@@ -49,8 +49,8 @@ var phyloxml_parser = function(xml, options) {
49
49
  function parsePhyloxml(node, index) {
50
50
  if (node.clade) {
51
51
  if (!Array.isArray(node.clade)) {
52
- node.clade = [node.clade];
53
- }
52
+ node.clade = [node.clade];
53
+ }
54
54
  node.clade.forEach(parsePhyloxml);
55
55
  node.children = node.clade;
56
56
  delete node.clade;
@@ -72,20 +72,20 @@ var phyloxml_parser = function(xml, options) {
72
72
  var tree_json;
73
73
 
74
74
  if (typeof xml === "string") {
75
- if (DOMParser) {
76
- const parser = new DOMParser();
77
- xml = parser.parseFromString(xml, "text/xml");
78
- } else {
79
- const parser = new XMLParser();
80
- xml = parser.parse(xml);
81
- }
75
+ if (DOMParser) {
76
+ const parser = new DOMParser();
77
+ xml = parser.parseFromString(xml, "text/xml");
78
+ } else {
79
+ const parser = new XMLParser();
80
+ xml = parser.parse(xml);
81
+ }
82
82
  }
83
83
 
84
84
  xml = xmlToJson(xml);
85
85
  var phylogeny = xml.phyloxml.phylogeny;
86
86
  if (Array.isArray(phylogeny)) {
87
- phylogeny = phylogeny[0];
88
- console.warn('PhyloXML files with multiple phylogenies are not currently supported. Only the first phylogeny will be loaded.')
87
+ phylogeny = phylogeny[0];
88
+ console.warn("PhyloXML files with multiple phylogenies are not currently supported. Only the first phylogeny will be loaded.")
89
89
  }
90
90
  tree_json = phylogeny.clade;
91
91
  tree_json.name = "root";
package/src/index.js CHANGED
@@ -1,12 +1,14 @@
1
1
  export { default as phylotree } from "./main.js";
2
2
 
3
3
  export { default as pairwise_distances } from "./metrics/pairwise-distances";
4
+ export { default as pairwiseDistances } from "./metrics/pairwise-distances";
4
5
  export { default as sackin } from "./metrics/sackins";
5
6
  export { centerOfTree } from "./metrics/center-of-tree";
6
7
  export { computeMidpoint } from "./metrics/compute-midpoint";
7
8
  export { default as rootToTip, fitRootToTip } from "./metrics/root-to-tip";
8
9
 
9
10
  export { default as extract_dates } from "./extract-dates";
11
+ export { default as extractDates } from "./extract-dates";
10
12
  export { default as clusterPicker } from "./clustering/cluster-picker";
11
13
  export { default as phylopart } from "./clustering/phylopart";
12
14
 
@@ -129,6 +129,10 @@ class TreeRender {
129
129
  this.node_styler = this.options['node-styler'];
130
130
  this.edge_styler = this.options['edge-styler'];
131
131
 
132
+ // Store zoom state to preserve across updates
133
+ this.currentZoomTransform = null;
134
+ this.baseTransform = { x: 0, y: 0 };
135
+
132
136
  this.nodeSpan = this.options['node-span'];
133
137
 
134
138
  if(!this.nodeSpan) {
@@ -313,6 +317,10 @@ class TreeRender {
313
317
 
314
318
  this.placenodes();
315
319
 
320
+ // Sync edge labels BEFORE drawing edges so that edge.selected reflects node.selected
321
+ // This is critical for custom edge stylers that rely on selection state
322
+ this.syncEdgeLabels();
323
+
316
324
  transitions = this.transitions(transitions);
317
325
 
318
326
  let node_id = 0;
@@ -321,15 +329,26 @@ class TreeRender {
321
329
  .selectAll("." + css_classes["tree-container"])
322
330
  .data([0]);
323
331
 
332
+ // Store base transform for composition with zoom
333
+ this.baseTransform = {
334
+ x: this.offsets[1] + this.options["left-offset"],
335
+ y: this.pad_height()
336
+ };
337
+
324
338
  enclosure = enclosure
325
339
  .enter()
326
340
  .append("g")
327
341
  .attr("class", css_classes["tree-container"])
328
342
  .merge(enclosure)
329
343
  .attr("transform", d => {
344
+ // Compose base transform with current zoom transform if present
345
+ if (this.currentZoomTransform && this.options["zoom"]) {
346
+ const zt = this.currentZoomTransform;
347
+ return `translate(${zt.x + this.baseTransform.x * zt.k}, ${zt.y + this.baseTransform.y * zt.k}) scale(${zt.k})`;
348
+ }
330
349
  return this.d3PhylotreeSvgTranslate([
331
- this.offsets[1] + this.options["left-offset"],
332
- this.pad_height()
350
+ this.baseTransform.x,
351
+ this.baseTransform.y
333
352
  ]);
334
353
  });
335
354
 
@@ -479,29 +498,39 @@ class TreeRender {
479
498
  brush.call(brush_object);
480
499
  }
481
500
 
482
- this.syncEdgeLabels();
501
+ // Note: syncEdgeLabels() is called at the start of update() before edges are drawn
502
+ // to ensure selection state is synced before reclassEdge and edge_styler run
483
503
 
484
504
  if (this.options["zoom"]) {
485
- let zoom = d3
486
- .zoom()
487
- .scaleExtent([0.1, 10])
488
- .on("zoom", (event) => {
489
-
490
- d3.select("." + css_classes["tree-container"]).attr("transform", d => {
491
- let toTransform = event.transform;
492
- return toTransform;
505
+ // Create zoom behavior if not already created
506
+ if (!this.zoomBehavior) {
507
+ this.zoomBehavior = d3
508
+ .zoom()
509
+ .scaleExtent([0.1, 10])
510
+ .on("zoom", (event) => {
511
+ // Store the current zoom transform
512
+ this.currentZoomTransform = event.transform;
513
+
514
+ // Compose zoom transform with base transform
515
+ const zt = event.transform;
516
+ const composedTransform = `translate(${zt.x + this.baseTransform.x * zt.k}, ${zt.y + this.baseTransform.y * zt.k}) scale(${zt.k})`;
517
+
518
+ // Use this.svg.select() to target only this tree instance (not global d3.select)
519
+ this.svg.select("." + css_classes["tree-container"]).attr("transform", composedTransform);
520
+
521
+ // Apply same transform to scale bar
522
+ this.svg.select("." + css_classes["tree-scale-bar"]).attr("transform", d => {
523
+ return `translate(${zt.x + this.baseTransform.x * zt.k}, ${zt.y + (this.baseTransform.y - 10) * zt.k}) scale(${zt.k})`;
524
+ });
493
525
  });
526
+ }
494
527
 
495
- // Give some extra room
496
- d3.select("." + css_classes["tree-scale-bar"]).attr("transform", d => {
497
- let toTransform = event.transform;
498
- toTransform.y -= 10;
499
- return toTransform;
500
- });
501
-
502
- });
528
+ this.svg.call(this.zoomBehavior);
503
529
 
504
- this.svg.call(zoom);
530
+ // Restore zoom transform if we have one stored (preserves zoom across updates)
531
+ if (this.currentZoomTransform) {
532
+ this.svg.call(this.zoomBehavior.transform, this.currentZoomTransform);
533
+ }
505
534
  }
506
535
 
507
536
  // Emit rendered event
@@ -1030,7 +1059,7 @@ class TreeRender {
1030
1059
  this.size[0] = this.radial_center + this.radius / scaler;
1031
1060
  this.size[1] = this.radial_center + this.radius / scaler;
1032
1061
  } else {
1033
- this.do_lr();
1062
+ this.do_lr();
1034
1063
 
1035
1064
  this.draw_branch = draw_line;
1036
1065
  this.edge_placer = lineSegmentPlacer;
@@ -1041,8 +1070,10 @@ this.do_lr();
1041
1070
  d.x *= this.scales[0];
1042
1071
  d.y *= this.scales[1]*.8;
1043
1072
 
1044
- if (this.options["layout"] == "right-to-left") {
1045
- d.y = this._extents[1][1] * this.scales[1] - d.y;
1073
+ if (this.options["layout"] == "right-to-left") {
1074
+ // For RTL, always add label_width offset to shift tree right,
1075
+ // creating space on the left for labels (prevents labels overlapping branches)
1076
+ d.y = this._extents[1][1] * this.scales[1] - d.y + this.label_width;
1046
1077
  }
1047
1078
 
1048
1079
 
@@ -53,17 +53,25 @@ export function resizeSvg(tree, svg, tr) {
53
53
  sizes[0] + 2 * pad_radius + vertical_offset
54
54
  ];
55
55
 
56
+ // Update base transform for radial layout
57
+ this.baseTransform = {
58
+ x: pad_radius,
59
+ y: pad_radius + vertical_offset
60
+ };
61
+
56
62
  if (svg) {
63
+ // Compose with zoom transform if present
64
+ let transform;
65
+ if (this.currentZoomTransform && this.options["zoom"]) {
66
+ const zt = this.currentZoomTransform;
67
+ transform = `translate(${zt.x + this.baseTransform.x * zt.k}, ${zt.y + this.baseTransform.y * zt.k}) scale(${zt.k})`;
68
+ } else {
69
+ transform = "translate(" + pad_radius + "," + (pad_radius + vertical_offset) + ")";
70
+ }
71
+
57
72
  svg
58
73
  .selectAll("." + css_classes["tree-container"])
59
- .attr(
60
- "transform",
61
- "translate (" +
62
- pad_radius +
63
- "," +
64
- (pad_radius + vertical_offset) +
65
- ")"
66
- );
74
+ .attr("transform", transform);
67
75
  }
68
76
  } else {
69
77
 
@@ -14,8 +14,10 @@ export function shiftTip(d) {
14
14
  ];
15
15
  }
16
16
 
17
- if (this.options["right-to-left"]) {
18
- return [this.right_most_leaf - d.screen_x, 0];
17
+ if (this.options["layout"] == "right-to-left") {
18
+ // For RTL, shift labels to align at the left edge (x=0)
19
+ // screen_x is the node's horizontal position; shifting by -screen_x moves label to x=0
20
+ return [-d.screen_x, 0];
19
21
  }
20
22
 
21
23
  return [this.right_most_leaf - d.screen_x, 0];
@@ -72,18 +74,27 @@ export function drawNode(container, node, transitions) {
72
74
  return d.text_align;
73
75
  });
74
76
  } else {
75
- labels = labels.attr("text-anchor", "start").attr("transform", d => {
76
- if (this.options["layout"] == "right-to-left") {
77
- return this.d3PhylotreeSvgTranslate([-20, 0]);
78
- }
79
- return this.d3PhylotreeSvgTranslate(
80
- this.alignTips() ? this.shiftTip(d) : null
81
- );
82
- });
77
+ const isRTL = this.options["layout"] == "right-to-left";
78
+ labels = labels
79
+ .attr("text-anchor", isRTL ? "end" : "start")
80
+ .attr("transform", d => {
81
+ return this.d3PhylotreeSvgTranslate(
82
+ this.alignTips() ? this.shiftTip(d) : null
83
+ );
84
+ });
83
85
  }
84
86
 
85
87
  if (this.alignTips()) {
86
88
  tracers = tracers.data([node]);
89
+ const isRTL = this.options["layout"] == "right-to-left";
90
+
91
+ // Determine direction multiplier for tracer start position
92
+ const getX1Direction = (d) => {
93
+ if (this.radial()) {
94
+ return d.text_align == "end" ? -1 : 1;
95
+ }
96
+ return isRTL ? -1 : 1;
97
+ };
87
98
 
88
99
  if (transitions) {
89
100
  tracers = tracers
@@ -92,27 +103,12 @@ export function drawNode(container, node, transitions) {
92
103
  .classed(this.css_classes["branch-tracer"], true)
93
104
  .merge(tracers)
94
105
  .attr("x1", d => {
95
- return (
96
- (d.text_align == "end" ? -1 : 1) * this.nodeBubbleSize(node)
97
- );
106
+ return getX1Direction(d) * this.nodeBubbleSize(node);
98
107
  })
99
108
  .attr("x2", 0)
100
109
  .attr("y1", 0)
101
110
  .attr("y2", 0)
102
111
  .attr("x2", d => {
103
- if (this.options["layout"] == "right-to-left") {
104
- return d.screen_x;
105
- }
106
-
107
- return this.shiftTip(d)[0];
108
- })
109
- .attr("transform", d => {
110
- return this.d3PhylotreeSvgRotate(d.text_angle);
111
- })
112
- .attr("x2", d => {
113
- if (this.options["layout"] == "right-to-left") {
114
- return d.screen_x;
115
- }
116
112
  return this.shiftTip(d)[0];
117
113
  })
118
114
  .attr("transform", d => {
@@ -125,9 +121,7 @@ export function drawNode(container, node, transitions) {
125
121
  .classed(this.css_classes["branch-tracer"], true)
126
122
  .merge(tracers)
127
123
  .attr("x1", d => {
128
- return (
129
- (d.text_align == "end" ? -1 : 1) * this.nodeBubbleSize(node)
130
- );
124
+ return getX1Direction(d) * this.nodeBubbleSize(node);
131
125
  })
132
126
  .attr("y2", 0)
133
127
  .attr("y1", 0)
@@ -157,17 +151,24 @@ export function drawNode(container, node, transitions) {
157
151
  });
158
152
 
159
153
  if (this.shown_font_size >= 5) {
154
+ const isRTL = this.options["layout"] == "right-to-left";
160
155
  labels = labels.attr("dx", d => {
161
- return (
162
- (d.text_align == "end" ? -1 : 1) *
163
- ((this.alignTips() ? 0 : shift) + this.shown_font_size * 0.33)
164
- );
156
+ // For radial, use text_align; for linear RTL, use negative offset; otherwise positive
157
+ const direction = this.radial()
158
+ ? (d.text_align == "end" ? -1 : 1)
159
+ : (isRTL ? -1 : 1);
160
+ return direction * ((this.alignTips() ? 0 : shift) + this.shown_font_size * 0.33);
165
161
  });
166
162
  }
167
163
  } else {
168
164
  if (this.shown_font_size >= 5) {
165
+ const isRTL = this.options["layout"] == "right-to-left";
169
166
  labels = labels.attr("dx", d => { // eslint-disable-line
170
- return (d.text_align == "end" ? -1 : 1) * this.shown_font_size * 0.33;
167
+ // For radial, use text_align; for linear RTL, use negative offset; otherwise positive
168
+ const direction = this.radial()
169
+ ? (d.text_align == "end" ? -1 : 1)
170
+ : (isRTL ? -1 : 1);
171
+ return direction * this.shown_font_size * 0.33;
171
172
  });
172
173
  }
173
174
  }
@@ -356,7 +357,7 @@ export function defNodeLabel(_node) {
356
357
  export function nodeLabel(attr) {
357
358
  if (!arguments.length) return this._nodeLabel;
358
359
  this._nodeLabel = attr ? attr : defNodeLabel;
359
- this.update();
360
+ this.update();
360
361
  return this;
361
362
  }
362
363
 
@@ -61,19 +61,7 @@ export function nodeBubbleSize(node) {
61
61
  }
62
62
  }
63
63
 
64
- export function shiftTip(d) {
65
- if (this.options["is-radial"]) {
66
- return [
67
- (d.text_align == "end" ? -1 : 1) *
68
- (this.radius_pad_for_bubbles - d.radius),
69
- 0
70
- ];
71
- }
72
- if (this.options["right-to-left"]) {
73
- return [this.right_most_leaf - d.screen_x, 0];
74
- }
75
- return [this.right_most_leaf - d.screen_x, 0];
76
- }
64
+ // shiftTip function is defined in nodes.js - removed duplicate here
77
65
 
78
66
  export function layoutHandler(attr) {
79
67
  if (!arguments.length) return this.layout_listener_handler;
@@ -38,11 +38,11 @@ export function initializeSelectionSets(sets) {
38
38
  * @private
39
39
  */
40
40
  export function _injectSetStyles(sets) {
41
- const styleId = 'phylotree-selection-set-styles';
41
+ const styleId = "phylotree-selection-set-styles";
42
42
  let styleEl = document.getElementById(styleId);
43
43
 
44
44
  if (!styleEl) {
45
- styleEl = document.createElement('style');
45
+ styleEl = document.createElement("style");
46
46
  styleEl.id = styleId;
47
47
  document.head.appendChild(styleEl);
48
48
  }
@@ -127,8 +127,8 @@ export function addToSet(node, setName) {
127
127
  return this;
128
128
  }
129
129
 
130
- const nodeName = typeof node === 'string' ? node : node.data.name;
131
- const nodeObj = typeof node === 'string'
130
+ const nodeName = typeof node === "string" ? node : node.data.name;
131
+ const nodeObj = typeof node === "string"
132
132
  ? this.phylotree.getNodeByName(node)
133
133
  : node;
134
134
 
@@ -141,8 +141,8 @@ export function addToSet(node, setName) {
141
141
  this._selectionSets[setName].members.add(nodeName);
142
142
  nodeObj._selectionSet = setName;
143
143
 
144
- this.emit('setChange', {
145
- action: 'add',
144
+ this.emit("setChange", {
145
+ action: "add",
146
146
  set: setName,
147
147
  node: nodeObj,
148
148
  allSets: this._getSetsSummary()
@@ -169,8 +169,8 @@ export function removeFromSet(node, setName) {
169
169
  return this;
170
170
  }
171
171
 
172
- const nodeName = typeof node === 'string' ? node : node.data.name;
173
- const nodeObj = typeof node === 'string'
172
+ const nodeName = typeof node === "string" ? node : node.data.name;
173
+ const nodeObj = typeof node === "string"
174
174
  ? this.phylotree.getNodeByName(node)
175
175
  : node;
176
176
 
@@ -180,8 +180,8 @@ export function removeFromSet(node, setName) {
180
180
  delete nodeObj._selectionSet;
181
181
  }
182
182
 
183
- this.emit('setChange', {
184
- action: 'remove',
183
+ this.emit("setChange", {
184
+ action: "remove",
185
185
  set: setName,
186
186
  node: nodeObj,
187
187
  allSets: this._getSetsSummary()