phyloio 2.1.0 → 2.1.1

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.
Files changed (39) hide show
  1. package/Examples/Website/phyloio.html +73 -71
  2. package/{src_phylo_compare/phylo.js → Examples/Website/src_worker_bcn_js.phylo.js} +25 -972
  3. package/{src_phylo_compare/vendors-node_modules_d3_index_js-node_modules_file-saver_dist_FileSaver_min_js.phylo.js → Examples/Website/src_worker_distance_js.phylo.js} +100 -2
  4. package/README.md +16 -2
  5. package/dist/phylo.js +7 -7
  6. package/dist/src_worker_bcn_js.phylo.js +2 -2
  7. package/dist/src_worker_distance_js.phylo.js +1 -1
  8. package/package-lock.json +19607 -0
  9. package/package.json +1 -1
  10. package/src/api.js +19 -9
  11. package/src/container.js +408 -64
  12. package/src/interface.css +6 -0
  13. package/src/interface.js +371 -207
  14. package/src/model.js +5 -0
  15. package/src/tmp +12 -0
  16. package/src/utils.js +31 -1
  17. package/src/viewer.js +177 -88
  18. package/src_phylo_compare/fonts/fa-brands-400.eot +0 -0
  19. package/src_phylo_compare/fonts/fa-brands-400.svg +0 -3717
  20. package/src_phylo_compare/fonts/fa-brands-400.ttf +0 -0
  21. package/src_phylo_compare/fonts/fa-brands-400.woff +0 -0
  22. package/src_phylo_compare/fonts/fa-brands-400.woff2 +0 -0
  23. package/src_phylo_compare/fonts/fa-regular-400.eot +0 -0
  24. package/src_phylo_compare/fonts/fa-regular-400.svg +0 -801
  25. package/src_phylo_compare/fonts/fa-regular-400.ttf +0 -0
  26. package/src_phylo_compare/fonts/fa-regular-400.woff +0 -0
  27. package/src_phylo_compare/fonts/fa-regular-400.woff2 +0 -0
  28. package/src_phylo_compare/fonts/fa-solid-900.eot +0 -0
  29. package/src_phylo_compare/fonts/fa-solid-900.svg +0 -5034
  30. package/src_phylo_compare/fonts/fa-solid-900.ttf +0 -0
  31. package/src_phylo_compare/fonts/fa-solid-900.woff +0 -0
  32. package/src_phylo_compare/fonts/fa-solid-900.woff2 +0 -0
  33. package/src_phylo_compare/fonts/fa-v4compatibility.ttf +0 -0
  34. package/src_phylo_compare/fonts/fa-v4compatibility.woff2 +0 -0
  35. package/src_phylo_compare/src_utils_js.phylo.js +0 -21
  36. package/src_phylo_compare/src_worker_bcn_js.phylo.js +0 -341
  37. package/src_phylo_compare/src_worker_distance_js.phylo.js +0 -227
  38. package/src_phylo_compare/vendors-node_modules_biojs-io-newick_src_index_js-node_modules_minhashjs_index_js.phylo.js +0 -1703
  39. package/src_phylo_compare.zip +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phyloio",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "JS library for visualising and comparing phylogenetic trees",
5
5
  "scripts": {
6
6
  "test": "npm run-script build-jest; jest --silent=false",
package/src/api.js CHANGED
@@ -11,6 +11,7 @@ export default class API {
11
11
  constructor() {
12
12
 
13
13
  this.settings = {
14
+ 'version' : 1,
14
15
  'phylostratigraphy' : false,
15
16
  'share_phylo': ' https://beta.phylo.io/viewer/',
16
17
  'share_post': ' https://beta.phylo.io/sharing/create/',
@@ -59,6 +60,7 @@ export default class API {
59
60
  this.bound_container = [] // pair of container used for distance computation
60
61
  this.session_token = null // unique session token for cloud saving
61
62
  this.session_url = null // url for cloud saving
63
+ this.session_answer = null; // data from reply when generating session
62
64
  this.phylo_embedded = false // phylo.io website mode
63
65
  this.distance = {
64
66
  'RF' : false,
@@ -418,7 +420,7 @@ export default class API {
418
420
 
419
421
  screen_shot(params){screen_shot(params)}
420
422
 
421
- generate_share_link(){
423
+ generate_share_link(callback){
422
424
 
423
425
  var that = this
424
426
  var xhr = new XMLHttpRequest();
@@ -428,22 +430,30 @@ export default class API {
428
430
  if (this.readyState != 4) return;
429
431
 
430
432
  else if (this.status == 201) {
431
- var data = JSON.parse(this.responseText);
432
-
433
- if (data.result = 'OK'){
434
- that.session_token = data.session
435
- that.session_url = that.settings.share_phylo + '?session=' + that.session_token
433
+ let data = JSON.parse(this.responseText);
434
+ that.session_answer = data;
435
+ if (data.result === 'OK'){
436
+ that.token = data.session;
437
+ that.session_url = that.settings.share_phylo + '?session=' + data.session;
436
438
  }
437
439
  }
438
440
 
439
441
  else if (this.status == 413) {
440
- that.session_token = 'ERROR_SIZE';
441
- return
442
+ let data = JSON.parse(this.responseText);
443
+ that.session_url = 'ERROR_SIZE';
444
+ that.session_answer = data;
442
445
  }
443
446
 
444
447
  else if (this.status == 400) {
445
- return
448
+ let data = JSON.parse(this.responseText) | {result: "Error", message: "The server does not accept this session data"};
449
+ that.session_answer = data
450
+ that.session_url = ""
451
+ }
452
+ else {
453
+ that.session_answer = {result: "Error", message: "The server is currently not available."}
454
+ that.session_url = ""
446
455
  }
456
+ callback(that)
447
457
  };
448
458
 
449
459
  xhr.open("POST", this.settings.share_post, false);