@figtreejs/core 0.1.0-beta.2 → 0.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.mjs +1702 -1665
- package/package.json +1 -1
- package/src/evo/tree/normalized-tree/immutable-tree.test.ts +46 -1
- package/src/evo/tree/normalized-tree/immutable-tree.ts +119 -23
- package/src/layouts/functional/radial-layout.ts +54 -26
- package/src/tests/baubles/__snapshots__/branch-labels.test.tsx.snap +16 -16
- package/src/tests/baubles/__snapshots__/node-labels.test.tsx.snap +34 -34
- package/src/tests/layouts/radiallayout.test.ts +4 -4
|
@@ -625,25 +625,25 @@ exports[`Node labels > renders a tree node labels in radial layout 1`] = `
|
|
|
625
625
|
class="branch-layer"
|
|
626
626
|
>
|
|
627
627
|
<path
|
|
628
|
-
d="M
|
|
628
|
+
d="M 306.5924779152444 95.03594795523999 C306.5924779152444,95.03594795523999 233.18495583048883,190.07189591047998 233.18495583048883,190.07189591047998 C233.18495583048883,190.07189591047998 196.48119478811105,237.5898698881 178.12931426692217,261.34885687690996 C178.12931426692217,261.34885687690996 168.95337400632775,273.22835037131495 164.36540387603054,279.1680971185175 C164.36540387603054,279.1680971185175 162.07141881088194,282.1379704921187 160.92442627830764,283.6229071789194 C160.92442627830764,283.6229071789194 160.35093001202046,284.3653755223197 160.06418187887687,284.7366096940199 C160.06418187887687,284.7366096940199 159.7774337457333,285.10784386572 159.7774337457333,285.10784386572 "
|
|
629
629
|
fill="none"
|
|
630
630
|
stroke="black"
|
|
631
631
|
stroke-width="2"
|
|
632
632
|
/>
|
|
633
633
|
<path
|
|
634
|
-
d="M
|
|
634
|
+
d="M 159.7774337457333 285.10784386572 C159.7774337457333,285.10784386572 79.88871687286665,293.2946004927189 79.88871687286665,293.2946004927189 C79.88871687286665,293.2946004927189 39.944358436433326,297.38797880621837 19.972179218216663,299.4346679629681 C19.972179218216663,299.4346679629681 9.986089609108332,300.45801254134295 4.993044804554166,300.96968483053035 C4.993044804554166,300.96968483053035 2.496522402277083,301.2255209751241 1.2482612011385414,301.3534390474209 C1.2482612011385414,301.3534390474209 0.6241306005692707,301.41739808356937 0.31206530028463536,301.4493776016436 C0.31206530028463536,301.4493776016436 0,301.4813571197178 0,301.4813571197178 "
|
|
635
635
|
fill="none"
|
|
636
636
|
stroke="black"
|
|
637
637
|
stroke-width="2"
|
|
638
638
|
/>
|
|
639
639
|
<path
|
|
640
|
-
d="M
|
|
640
|
+
d="M 159.7774337457333 285.10784386572 C159.7774337457333,285.10784386572 196.69432122862028,332.55392193286 196.69432122862028,332.55392193286 C196.69432122862028,332.55392193286 215.15276497006377,356.27696096643 224.38198684078552,368.138480483215 C224.38198684078552,368.138480483215 228.9965977761464,374.06924024160753 231.30390324382682,377.03462012080377 C231.30390324382682,377.03462012080377 232.45755597766703,378.5173100604019 233.03438234458713,379.25865503020094 C233.03438234458713,379.25865503020094 233.3227955280472,379.6293275151005 233.46700211977725,379.81466375755025 C233.46700211977725,379.81466375755025 233.61120871150726,380 233.61120871150726,380 "
|
|
641
641
|
fill="none"
|
|
642
642
|
stroke="black"
|
|
643
643
|
stroke-width="2"
|
|
644
644
|
/>
|
|
645
645
|
<path
|
|
646
|
-
d="M
|
|
646
|
+
d="M 306.5924779152444 95.03594795523999 C306.5924779152444,95.03594795523999 343.2962389576222,47.517973977619995 343.2962389576222,47.517973977619995 C343.2962389576222,47.517973977619995 361.6481194788111,23.758986988809998 370.8240597394056,11.879493494404999 C370.8240597394056,11.879493494404999 375.4120298697028,5.939746747202499 377.7060149348514,2.9698733736012497 C377.7060149348514,2.9698733736012497 378.8530074674257,1.4849366868006248 379.4265037337128,0.7424683434003124 C379.4265037337128,0.7424683434003124 379.7132518668564,0.3712341717001562 379.8566259334282,0.1856170858500781 C379.8566259334282,0.1856170858500781 380,0 380,0 "
|
|
647
647
|
fill="none"
|
|
648
648
|
stroke="black"
|
|
649
649
|
stroke-width="2"
|
|
@@ -655,13 +655,13 @@ exports[`Node labels > renders a tree node labels in radial layout 1`] = `
|
|
|
655
655
|
<g>
|
|
656
656
|
<text
|
|
657
657
|
alignment-baseline="middle"
|
|
658
|
-
text-anchor="
|
|
659
|
-
transform="translate(
|
|
658
|
+
text-anchor=" start"
|
|
659
|
+
transform="translate(310.83511860236365,99.27858864235928) rotate(45.00000000000005)"
|
|
660
660
|
>
|
|
661
661
|
Label!
|
|
662
662
|
</text>
|
|
663
663
|
<path
|
|
664
|
-
d="
|
|
664
|
+
d="M306.5924779152444 95.03594795523999L306.5924779152444 95.03594795523999"
|
|
665
665
|
stroke="grey"
|
|
666
666
|
stroke-dasharray="2"
|
|
667
667
|
stroke-width="1"
|
|
@@ -671,12 +671,12 @@ exports[`Node labels > renders a tree node labels in radial layout 1`] = `
|
|
|
671
671
|
<text
|
|
672
672
|
alignment-baseline="middle"
|
|
673
673
|
text-anchor="end"
|
|
674
|
-
transform="translate(
|
|
674
|
+
transform="translate(157.05349074729602,290.4538830108502) rotate(-62.99999999999994)"
|
|
675
675
|
>
|
|
676
676
|
Label!
|
|
677
677
|
</text>
|
|
678
678
|
<path
|
|
679
|
-
d="
|
|
679
|
+
d="M159.7774337457333 285.10784386572L159.7774337457333 285.10784386572"
|
|
680
680
|
stroke="grey"
|
|
681
681
|
stroke-dasharray="2"
|
|
682
682
|
stroke-width="1"
|
|
@@ -685,13 +685,13 @@ exports[`Node labels > renders a tree node labels in radial layout 1`] = `
|
|
|
685
685
|
<g>
|
|
686
686
|
<text
|
|
687
687
|
alignment-baseline="middle"
|
|
688
|
-
text-anchor="
|
|
689
|
-
transform="translate(
|
|
688
|
+
text-anchor="end"
|
|
689
|
+
transform="translate(-5.928883166189175,302.40241325355476) rotate(-8.830353996706094)"
|
|
690
690
|
>
|
|
691
691
|
Label!
|
|
692
692
|
</text>
|
|
693
693
|
<path
|
|
694
|
-
d="
|
|
694
|
+
d="M0 301.4813571197178L0 301.4813571197178"
|
|
695
695
|
stroke="grey"
|
|
696
696
|
stroke-dasharray="2"
|
|
697
697
|
stroke-width="1"
|
|
@@ -700,13 +700,13 @@ exports[`Node labels > renders a tree node labels in radial layout 1`] = `
|
|
|
700
700
|
<g>
|
|
701
701
|
<text
|
|
702
702
|
alignment-baseline="middle"
|
|
703
|
-
text-anchor="
|
|
704
|
-
transform="translate(
|
|
703
|
+
text-anchor=" start"
|
|
704
|
+
transform="translate(236.350968734111,385.33795045111344) rotate(62.8303539967062)"
|
|
705
705
|
>
|
|
706
706
|
Label!
|
|
707
707
|
</text>
|
|
708
708
|
<path
|
|
709
|
-
d="
|
|
709
|
+
d="M233.61120871150726 380L233.61120871150726 380"
|
|
710
710
|
stroke="grey"
|
|
711
711
|
stroke-dasharray="2"
|
|
712
712
|
stroke-width="1"
|
|
@@ -716,12 +716,12 @@ exports[`Node labels > renders a tree node labels in radial layout 1`] = `
|
|
|
716
716
|
<text
|
|
717
717
|
alignment-baseline="middle"
|
|
718
718
|
text-anchor=" start"
|
|
719
|
-
transform="translate(
|
|
719
|
+
transform="translate(382.7239429984373,-5.346039145130206) rotate(657)"
|
|
720
720
|
>
|
|
721
721
|
Label!
|
|
722
722
|
</text>
|
|
723
723
|
<path
|
|
724
|
-
d="M380
|
|
724
|
+
d="M380 0L380 0"
|
|
725
725
|
stroke="grey"
|
|
726
726
|
stroke-dasharray="2"
|
|
727
727
|
stroke-width="1"
|
|
@@ -748,25 +748,25 @@ exports[`Node labels > renders a tree node labels in radial layout 1`] = `
|
|
|
748
748
|
class="branch-layer"
|
|
749
749
|
>
|
|
750
750
|
<path
|
|
751
|
-
d="M
|
|
751
|
+
d="M 306.5924779152444 95.03594795523999 C306.5924779152444,95.03594795523999 233.18495583048883,190.07189591047998 233.18495583048883,190.07189591047998 C233.18495583048883,190.07189591047998 196.48119478811105,237.5898698881 178.12931426692217,261.34885687690996 C178.12931426692217,261.34885687690996 168.95337400632775,273.22835037131495 164.36540387603054,279.1680971185175 C164.36540387603054,279.1680971185175 162.07141881088194,282.1379704921187 160.92442627830764,283.6229071789194 C160.92442627830764,283.6229071789194 160.35093001202046,284.3653755223197 160.06418187887687,284.7366096940199 C160.06418187887687,284.7366096940199 159.7774337457333,285.10784386572 159.7774337457333,285.10784386572 "
|
|
752
752
|
fill="none"
|
|
753
753
|
stroke="black"
|
|
754
754
|
stroke-width="2"
|
|
755
755
|
/>
|
|
756
756
|
<path
|
|
757
|
-
d="M
|
|
757
|
+
d="M 159.7774337457333 285.10784386572 C159.7774337457333,285.10784386572 79.88871687286665,293.2946004927189 79.88871687286665,293.2946004927189 C79.88871687286665,293.2946004927189 39.944358436433326,297.38797880621837 19.972179218216663,299.4346679629681 C19.972179218216663,299.4346679629681 9.986089609108332,300.45801254134295 4.993044804554166,300.96968483053035 C4.993044804554166,300.96968483053035 2.496522402277083,301.2255209751241 1.2482612011385414,301.3534390474209 C1.2482612011385414,301.3534390474209 0.6241306005692707,301.41739808356937 0.31206530028463536,301.4493776016436 C0.31206530028463536,301.4493776016436 0,301.4813571197178 0,301.4813571197178 "
|
|
758
758
|
fill="none"
|
|
759
759
|
stroke="black"
|
|
760
760
|
stroke-width="2"
|
|
761
761
|
/>
|
|
762
762
|
<path
|
|
763
|
-
d="M
|
|
763
|
+
d="M 159.7774337457333 285.10784386572 C159.7774337457333,285.10784386572 196.69432122862028,332.55392193286 196.69432122862028,332.55392193286 C196.69432122862028,332.55392193286 215.15276497006377,356.27696096643 224.38198684078552,368.138480483215 C224.38198684078552,368.138480483215 228.9965977761464,374.06924024160753 231.30390324382682,377.03462012080377 C231.30390324382682,377.03462012080377 232.45755597766703,378.5173100604019 233.03438234458713,379.25865503020094 C233.03438234458713,379.25865503020094 233.3227955280472,379.6293275151005 233.46700211977725,379.81466375755025 C233.46700211977725,379.81466375755025 233.61120871150726,380 233.61120871150726,380 "
|
|
764
764
|
fill="none"
|
|
765
765
|
stroke="black"
|
|
766
766
|
stroke-width="2"
|
|
767
767
|
/>
|
|
768
768
|
<path
|
|
769
|
-
d="M
|
|
769
|
+
d="M 306.5924779152444 95.03594795523999 C306.5924779152444,95.03594795523999 343.2962389576222,47.517973977619995 343.2962389576222,47.517973977619995 C343.2962389576222,47.517973977619995 361.6481194788111,23.758986988809998 370.8240597394056,11.879493494404999 C370.8240597394056,11.879493494404999 375.4120298697028,5.939746747202499 377.7060149348514,2.9698733736012497 C377.7060149348514,2.9698733736012497 378.8530074674257,1.4849366868006248 379.4265037337128,0.7424683434003124 C379.4265037337128,0.7424683434003124 379.7132518668564,0.3712341717001562 379.8566259334282,0.1856170858500781 C379.8566259334282,0.1856170858500781 380,0 380,0 "
|
|
770
770
|
fill="none"
|
|
771
771
|
stroke="black"
|
|
772
772
|
stroke-width="2"
|
|
@@ -778,13 +778,13 @@ exports[`Node labels > renders a tree node labels in radial layout 1`] = `
|
|
|
778
778
|
<g>
|
|
779
779
|
<text
|
|
780
780
|
alignment-baseline="middle"
|
|
781
|
-
text-anchor="
|
|
782
|
-
transform="translate(
|
|
781
|
+
text-anchor=" start"
|
|
782
|
+
transform="translate(310.83511860236365,99.27858864235928) rotate(45.00000000000005)"
|
|
783
783
|
>
|
|
784
784
|
Label!
|
|
785
785
|
</text>
|
|
786
786
|
<path
|
|
787
|
-
d="
|
|
787
|
+
d="M306.5924779152444 95.03594795523999L306.5924779152444 95.03594795523999"
|
|
788
788
|
stroke="grey"
|
|
789
789
|
stroke-dasharray="2"
|
|
790
790
|
stroke-width="1"
|
|
@@ -794,12 +794,12 @@ exports[`Node labels > renders a tree node labels in radial layout 1`] = `
|
|
|
794
794
|
<text
|
|
795
795
|
alignment-baseline="middle"
|
|
796
796
|
text-anchor="end"
|
|
797
|
-
transform="translate(
|
|
797
|
+
transform="translate(157.05349074729602,290.4538830108502) rotate(-62.99999999999994)"
|
|
798
798
|
>
|
|
799
799
|
Label!
|
|
800
800
|
</text>
|
|
801
801
|
<path
|
|
802
|
-
d="
|
|
802
|
+
d="M159.7774337457333 285.10784386572L159.7774337457333 285.10784386572"
|
|
803
803
|
stroke="grey"
|
|
804
804
|
stroke-dasharray="2"
|
|
805
805
|
stroke-width="1"
|
|
@@ -808,13 +808,13 @@ exports[`Node labels > renders a tree node labels in radial layout 1`] = `
|
|
|
808
808
|
<g>
|
|
809
809
|
<text
|
|
810
810
|
alignment-baseline="middle"
|
|
811
|
-
text-anchor="
|
|
812
|
-
transform="translate(
|
|
811
|
+
text-anchor="end"
|
|
812
|
+
transform="translate(-5.928883166189175,302.40241325355476) rotate(-8.830353996706094)"
|
|
813
813
|
>
|
|
814
814
|
Label!
|
|
815
815
|
</text>
|
|
816
816
|
<path
|
|
817
|
-
d="
|
|
817
|
+
d="M0 301.4813571197178L0 301.4813571197178"
|
|
818
818
|
stroke="grey"
|
|
819
819
|
stroke-dasharray="2"
|
|
820
820
|
stroke-width="1"
|
|
@@ -823,13 +823,13 @@ exports[`Node labels > renders a tree node labels in radial layout 1`] = `
|
|
|
823
823
|
<g>
|
|
824
824
|
<text
|
|
825
825
|
alignment-baseline="middle"
|
|
826
|
-
text-anchor="
|
|
827
|
-
transform="translate(
|
|
826
|
+
text-anchor=" start"
|
|
827
|
+
transform="translate(236.350968734111,385.33795045111344) rotate(62.8303539967062)"
|
|
828
828
|
>
|
|
829
829
|
Label!
|
|
830
830
|
</text>
|
|
831
831
|
<path
|
|
832
|
-
d="
|
|
832
|
+
d="M233.61120871150726 380L233.61120871150726 380"
|
|
833
833
|
stroke="grey"
|
|
834
834
|
stroke-dasharray="2"
|
|
835
835
|
stroke-width="1"
|
|
@@ -839,12 +839,12 @@ exports[`Node labels > renders a tree node labels in radial layout 1`] = `
|
|
|
839
839
|
<text
|
|
840
840
|
alignment-baseline="middle"
|
|
841
841
|
text-anchor=" start"
|
|
842
|
-
transform="translate(
|
|
842
|
+
transform="translate(382.7239429984373,-5.346039145130206) rotate(657)"
|
|
843
843
|
>
|
|
844
844
|
Label!
|
|
845
845
|
</text>
|
|
846
846
|
<path
|
|
847
|
-
d="M380
|
|
847
|
+
d="M380 0L380 0"
|
|
848
848
|
stroke="grey"
|
|
849
849
|
stroke-dasharray="2"
|
|
850
850
|
stroke-width="1"
|
|
@@ -12,12 +12,12 @@ describe("Test rectangular layout", () => {
|
|
|
12
12
|
// //a
|
|
13
13
|
const a = tree.getNodeByTaxon(tree.getTaxonByName("a"));
|
|
14
14
|
const aV = layout(a);
|
|
15
|
-
expect(aV.x).toBeCloseTo(
|
|
16
|
-
expect(aV.y).toBeCloseTo(
|
|
15
|
+
expect(aV.x).toBeCloseTo(-1.4421376941044097);
|
|
16
|
+
expect(aV.y).toBeCloseTo(1.0445158798278553);
|
|
17
17
|
|
|
18
18
|
const c = tree.getNodeByTaxon(tree.getTaxonByName("c"));
|
|
19
19
|
const cV = layout(c);
|
|
20
|
-
expect(cV.x).toBeCloseTo(0.
|
|
21
|
-
expect(cV.y).toBeCloseTo(0.
|
|
20
|
+
expect(cV.x).toBeCloseTo(0.4539904997395474);
|
|
21
|
+
expect(cV.y).toBeCloseTo(-0.8910065241883676);
|
|
22
22
|
});
|
|
23
23
|
});
|