@next-bricks/diagram 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bricks.json +1 -1
- package/dist/chunks/1762.4cfa224f.js +3 -0
- package/dist/chunks/1762.4cfa224f.js.map +1 -0
- package/dist/chunks/5839.d48f7365.js +2 -0
- package/dist/chunks/5839.d48f7365.js.map +1 -0
- package/dist/chunks/9393.b98f4561.js +2 -0
- package/dist/chunks/9393.b98f4561.js.map +1 -0
- package/dist/chunks/eo-diagram.923f9225.js +2 -0
- package/dist/chunks/eo-diagram.923f9225.js.map +1 -0
- package/dist/chunks/{main.6da2bc2b.js → main.3d132876.js} +2 -2
- package/dist/chunks/{main.6da2bc2b.js.map → main.3d132876.js.map} +1 -1
- package/dist/examples.json +1 -1
- package/dist/{index.9d85a46c.js → index.96bf41fb.js} +2 -2
- package/dist/{index.9d85a46c.js.map → index.96bf41fb.js.map} +1 -1
- package/dist/manifest.json +2 -2
- package/dist/types.json +228 -132
- package/dist-types/diagram/LineLabelComponent.d.ts +3 -4
- package/dist-types/diagram/hooks/useRenderedDiagram.d.ts +12 -0
- package/dist-types/diagram/index.d.ts +5 -5
- package/dist-types/diagram/interfaces.d.ts +64 -12
- package/dist-types/diagram/lines/curveLine.d.ts +1 -1
- package/dist-types/diagram/lines/getDirectLinePoints.d.ts +2 -0
- package/dist-types/diagram/processors/adjustLineLabels.d.ts +2 -0
- package/dist-types/diagram/processors/adjustLineLabels.spec.d.ts +1 -0
- package/dist-types/diagram/processors/adjustNodesPosition.d.ts +2 -0
- package/dist-types/diagram/processors/adjustNodesSize.d.ts +2 -0
- package/dist-types/diagram/processors/getDagreGraph.d.ts +2 -3
- package/dist-types/diagram/processors/getForceGraph.d.ts +2 -0
- package/dist-types/diagram/processors/getRenderedLines.d.ts +2 -0
- package/dist-types/diagram/processors/normalizeLinesAndMarkers.d.ts +6 -0
- package/dist-types/diagram/processors/normalizeLinesAndMarkers.spec.d.ts +1 -0
- package/docs/eo-diagram.md +212 -0
- package/package.json +2 -2
- package/dist/chunks/7312.7dd56138.js +0 -3
- package/dist/chunks/7312.7dd56138.js.map +0 -1
- package/dist/chunks/7675.0a3127d8.js +0 -2
- package/dist/chunks/7675.0a3127d8.js.map +0 -1
- package/dist/chunks/9393.fa7c8f8a.js +0 -2
- package/dist/chunks/9393.fa7c8f8a.js.map +0 -1
- package/dist/chunks/eo-diagram.322fc715.js +0 -2
- package/dist/chunks/eo-diagram.322fc715.js.map +0 -1
- package/dist-types/diagram/processors/getRenderedDiagram.d.ts +0 -11
- package/dist-types/diagram/processors/getRenderedLinesAndMarkers.d.ts +0 -5
- /package/dist/chunks/{7312.7dd56138.js.LICENSE.txt → 1762.4cfa224f.js.LICENSE.txt} +0 -0
- /package/dist-types/diagram/{processors/getRenderedLinesAndMarkers.spec.d.ts → lines/getDirectLinePoints.spec.d.ts} +0 -0
package/dist/types.json
CHANGED
|
@@ -71,8 +71,17 @@
|
|
|
71
71
|
{
|
|
72
72
|
"name": "layout",
|
|
73
73
|
"annotation": {
|
|
74
|
-
"type": "
|
|
75
|
-
"
|
|
74
|
+
"type": "union",
|
|
75
|
+
"types": [
|
|
76
|
+
{
|
|
77
|
+
"type": "jsLiteral",
|
|
78
|
+
"value": "dagre"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"type": "jsLiteral",
|
|
82
|
+
"value": "force"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
76
85
|
}
|
|
77
86
|
},
|
|
78
87
|
{
|
|
@@ -133,7 +142,7 @@
|
|
|
133
142
|
"type": "reference",
|
|
134
143
|
"typeName": {
|
|
135
144
|
"type": "identifier",
|
|
136
|
-
"name": "
|
|
145
|
+
"name": "LayoutOptions"
|
|
137
146
|
}
|
|
138
147
|
}
|
|
139
148
|
},
|
|
@@ -674,11 +683,26 @@
|
|
|
674
683
|
"name": "text"
|
|
675
684
|
},
|
|
676
685
|
"annotation": {
|
|
677
|
-
"type": "
|
|
678
|
-
"
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
686
|
+
"type": "union",
|
|
687
|
+
"types": [
|
|
688
|
+
{
|
|
689
|
+
"type": "reference",
|
|
690
|
+
"typeName": {
|
|
691
|
+
"type": "identifier",
|
|
692
|
+
"name": "TextOptions"
|
|
693
|
+
}
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
"type": "array",
|
|
697
|
+
"elementType": {
|
|
698
|
+
"type": "reference",
|
|
699
|
+
"typeName": {
|
|
700
|
+
"type": "identifier",
|
|
701
|
+
"name": "TextOptions"
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
]
|
|
682
706
|
},
|
|
683
707
|
"optional": true,
|
|
684
708
|
"computed": false
|
|
@@ -690,11 +714,26 @@
|
|
|
690
714
|
"name": "label"
|
|
691
715
|
},
|
|
692
716
|
"annotation": {
|
|
693
|
-
"type": "
|
|
694
|
-
"
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
717
|
+
"type": "union",
|
|
718
|
+
"types": [
|
|
719
|
+
{
|
|
720
|
+
"type": "reference",
|
|
721
|
+
"typeName": {
|
|
722
|
+
"type": "identifier",
|
|
723
|
+
"name": "LineLabelConf"
|
|
724
|
+
}
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
"type": "array",
|
|
728
|
+
"elementType": {
|
|
729
|
+
"type": "reference",
|
|
730
|
+
"typeName": {
|
|
731
|
+
"type": "identifier",
|
|
732
|
+
"name": "LineLabelConf"
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
]
|
|
698
737
|
},
|
|
699
738
|
"optional": true,
|
|
700
739
|
"computed": false
|
|
@@ -762,9 +801,46 @@
|
|
|
762
801
|
},
|
|
763
802
|
"optional": true,
|
|
764
803
|
"computed": false
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
"type": "propertySignature",
|
|
807
|
+
"key": {
|
|
808
|
+
"type": "identifier",
|
|
809
|
+
"name": "placement"
|
|
810
|
+
},
|
|
811
|
+
"annotation": {
|
|
812
|
+
"type": "reference",
|
|
813
|
+
"typeName": {
|
|
814
|
+
"type": "identifier",
|
|
815
|
+
"name": "LineLabelPlacement"
|
|
816
|
+
}
|
|
817
|
+
},
|
|
818
|
+
"optional": true,
|
|
819
|
+
"computed": false
|
|
765
820
|
}
|
|
766
821
|
]
|
|
767
822
|
},
|
|
823
|
+
{
|
|
824
|
+
"type": "typeAlias",
|
|
825
|
+
"name": "LineLabelPlacement",
|
|
826
|
+
"annotation": {
|
|
827
|
+
"type": "union",
|
|
828
|
+
"types": [
|
|
829
|
+
{
|
|
830
|
+
"type": "jsLiteral",
|
|
831
|
+
"value": "center"
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
"type": "jsLiteral",
|
|
835
|
+
"value": "start"
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
"type": "jsLiteral",
|
|
839
|
+
"value": "end"
|
|
840
|
+
}
|
|
841
|
+
]
|
|
842
|
+
}
|
|
843
|
+
},
|
|
768
844
|
{
|
|
769
845
|
"type": "interface",
|
|
770
846
|
"name": "LineLabelConf",
|
|
@@ -809,29 +885,52 @@
|
|
|
809
885
|
}
|
|
810
886
|
},
|
|
811
887
|
"computed": false
|
|
812
|
-
}
|
|
813
|
-
]
|
|
814
|
-
},
|
|
815
|
-
{
|
|
816
|
-
"type": "interface",
|
|
817
|
-
"name": "LayoutOptionsDagre",
|
|
818
|
-
"body": [
|
|
888
|
+
},
|
|
819
889
|
{
|
|
820
890
|
"type": "propertySignature",
|
|
821
891
|
"key": {
|
|
822
892
|
"type": "identifier",
|
|
823
|
-
"name": "
|
|
893
|
+
"name": "placement"
|
|
824
894
|
},
|
|
825
895
|
"annotation": {
|
|
826
896
|
"type": "reference",
|
|
827
897
|
"typeName": {
|
|
828
898
|
"type": "identifier",
|
|
829
|
-
"name": "
|
|
899
|
+
"name": "LineLabelPlacement"
|
|
830
900
|
}
|
|
831
901
|
},
|
|
832
902
|
"optional": true,
|
|
833
903
|
"computed": false
|
|
834
|
-
}
|
|
904
|
+
}
|
|
905
|
+
]
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
"type": "typeAlias",
|
|
909
|
+
"name": "LayoutOptions",
|
|
910
|
+
"annotation": {
|
|
911
|
+
"type": "union",
|
|
912
|
+
"types": [
|
|
913
|
+
{
|
|
914
|
+
"type": "reference",
|
|
915
|
+
"typeName": {
|
|
916
|
+
"type": "identifier",
|
|
917
|
+
"name": "LayoutOptionsDagre"
|
|
918
|
+
}
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
"type": "reference",
|
|
922
|
+
"typeName": {
|
|
923
|
+
"type": "identifier",
|
|
924
|
+
"name": "LayoutOptionsForce"
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
]
|
|
928
|
+
}
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
"type": "interface",
|
|
932
|
+
"name": "LayoutOptionsDagre",
|
|
933
|
+
"body": [
|
|
835
934
|
{
|
|
836
935
|
"type": "propertySignature",
|
|
837
936
|
"key": {
|
|
@@ -931,130 +1030,127 @@
|
|
|
931
1030
|
"optional": true,
|
|
932
1031
|
"computed": false
|
|
933
1032
|
}
|
|
1033
|
+
],
|
|
1034
|
+
"extends": [
|
|
1035
|
+
{
|
|
1036
|
+
"type": "expressionWithTypeArguments",
|
|
1037
|
+
"expression": {
|
|
1038
|
+
"type": "identifier",
|
|
1039
|
+
"name": "BaseLayoutOptions"
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
934
1042
|
]
|
|
935
1043
|
},
|
|
936
1044
|
{
|
|
937
|
-
"type": "
|
|
938
|
-
"name": "
|
|
939
|
-
"
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
{
|
|
1045
|
+
"type": "interface",
|
|
1046
|
+
"name": "LayoutOptionsForce",
|
|
1047
|
+
"body": [
|
|
1048
|
+
{
|
|
1049
|
+
"type": "propertySignature",
|
|
1050
|
+
"key": {
|
|
1051
|
+
"type": "identifier",
|
|
1052
|
+
"name": "dummyNodesOnEdges"
|
|
1053
|
+
},
|
|
1054
|
+
"annotation": {
|
|
943
1055
|
"type": "keyword",
|
|
944
1056
|
"value": "number"
|
|
945
1057
|
},
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
"type": "keyword",
|
|
955
|
-
"value": "number"
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
]
|
|
959
|
-
},
|
|
960
|
-
{
|
|
961
|
-
"type": "tuple",
|
|
962
|
-
"elementTypes": [
|
|
963
|
-
{
|
|
964
|
-
"type": "namedTupleMember",
|
|
965
|
-
"label": "vertical",
|
|
966
|
-
"optional": false,
|
|
967
|
-
"elementType": {
|
|
968
|
-
"type": "keyword",
|
|
969
|
-
"value": "number"
|
|
970
|
-
}
|
|
971
|
-
},
|
|
972
|
-
{
|
|
973
|
-
"type": "namedTupleMember",
|
|
974
|
-
"label": "horizontal",
|
|
975
|
-
"optional": false,
|
|
976
|
-
"elementType": {
|
|
977
|
-
"type": "keyword",
|
|
978
|
-
"value": "number"
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
]
|
|
1058
|
+
"optional": true,
|
|
1059
|
+
"computed": false
|
|
1060
|
+
},
|
|
1061
|
+
{
|
|
1062
|
+
"type": "propertySignature",
|
|
1063
|
+
"key": {
|
|
1064
|
+
"type": "identifier",
|
|
1065
|
+
"name": "collide"
|
|
982
1066
|
},
|
|
983
|
-
{
|
|
984
|
-
"type": "
|
|
985
|
-
"
|
|
986
|
-
{
|
|
987
|
-
"type": "namedTupleMember",
|
|
988
|
-
"label": "top",
|
|
989
|
-
"optional": false,
|
|
990
|
-
"elementType": {
|
|
991
|
-
"type": "keyword",
|
|
992
|
-
"value": "number"
|
|
993
|
-
}
|
|
994
|
-
},
|
|
1067
|
+
"annotation": {
|
|
1068
|
+
"type": "union",
|
|
1069
|
+
"types": [
|
|
995
1070
|
{
|
|
996
|
-
"type": "
|
|
997
|
-
"
|
|
998
|
-
"optional": false,
|
|
999
|
-
"elementType": {
|
|
1000
|
-
"type": "keyword",
|
|
1001
|
-
"value": "number"
|
|
1002
|
-
}
|
|
1071
|
+
"type": "keyword",
|
|
1072
|
+
"value": "boolean"
|
|
1003
1073
|
},
|
|
1004
1074
|
{
|
|
1005
|
-
"type": "
|
|
1006
|
-
"
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
"type": "keyword",
|
|
1010
|
-
"value": "number"
|
|
1075
|
+
"type": "reference",
|
|
1076
|
+
"typeName": {
|
|
1077
|
+
"type": "identifier",
|
|
1078
|
+
"name": "ForceCollideOptions"
|
|
1011
1079
|
}
|
|
1012
1080
|
}
|
|
1013
1081
|
]
|
|
1014
1082
|
},
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
}
|
|
1026
|
-
},
|
|
1027
|
-
{
|
|
1028
|
-
"type": "namedTupleMember",
|
|
1029
|
-
"label": "right",
|
|
1030
|
-
"optional": false,
|
|
1031
|
-
"elementType": {
|
|
1032
|
-
"type": "keyword",
|
|
1033
|
-
"value": "number"
|
|
1034
|
-
}
|
|
1035
|
-
},
|
|
1036
|
-
{
|
|
1037
|
-
"type": "namedTupleMember",
|
|
1038
|
-
"label": "bottom",
|
|
1039
|
-
"optional": false,
|
|
1040
|
-
"elementType": {
|
|
1041
|
-
"type": "keyword",
|
|
1042
|
-
"value": "number"
|
|
1043
|
-
}
|
|
1044
|
-
},
|
|
1045
|
-
{
|
|
1046
|
-
"type": "namedTupleMember",
|
|
1047
|
-
"label": "left",
|
|
1048
|
-
"optional": false,
|
|
1049
|
-
"elementType": {
|
|
1050
|
-
"type": "keyword",
|
|
1051
|
-
"value": "number"
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
]
|
|
1083
|
+
"optional": true,
|
|
1084
|
+
"computed": false
|
|
1085
|
+
}
|
|
1086
|
+
],
|
|
1087
|
+
"extends": [
|
|
1088
|
+
{
|
|
1089
|
+
"type": "expressionWithTypeArguments",
|
|
1090
|
+
"expression": {
|
|
1091
|
+
"type": "identifier",
|
|
1092
|
+
"name": "BaseLayoutOptions"
|
|
1055
1093
|
}
|
|
1056
|
-
|
|
1057
|
-
|
|
1094
|
+
}
|
|
1095
|
+
]
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
"type": "interface",
|
|
1099
|
+
"name": "ForceCollideOptions",
|
|
1100
|
+
"body": [
|
|
1101
|
+
{
|
|
1102
|
+
"type": "propertySignature",
|
|
1103
|
+
"key": {
|
|
1104
|
+
"type": "identifier",
|
|
1105
|
+
"name": "dummyRadius"
|
|
1106
|
+
},
|
|
1107
|
+
"annotation": {
|
|
1108
|
+
"type": "keyword",
|
|
1109
|
+
"value": "number"
|
|
1110
|
+
},
|
|
1111
|
+
"optional": true,
|
|
1112
|
+
"computed": false
|
|
1113
|
+
},
|
|
1114
|
+
{
|
|
1115
|
+
"type": "propertySignature",
|
|
1116
|
+
"key": {
|
|
1117
|
+
"type": "identifier",
|
|
1118
|
+
"name": "radiusDiff"
|
|
1119
|
+
},
|
|
1120
|
+
"annotation": {
|
|
1121
|
+
"type": "keyword",
|
|
1122
|
+
"value": "number"
|
|
1123
|
+
},
|
|
1124
|
+
"optional": true,
|
|
1125
|
+
"computed": false
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
"type": "propertySignature",
|
|
1129
|
+
"key": {
|
|
1130
|
+
"type": "identifier",
|
|
1131
|
+
"name": "strength"
|
|
1132
|
+
},
|
|
1133
|
+
"annotation": {
|
|
1134
|
+
"type": "keyword",
|
|
1135
|
+
"value": "number"
|
|
1136
|
+
},
|
|
1137
|
+
"optional": true,
|
|
1138
|
+
"computed": false
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
"type": "propertySignature",
|
|
1142
|
+
"key": {
|
|
1143
|
+
"type": "identifier",
|
|
1144
|
+
"name": "iterations"
|
|
1145
|
+
},
|
|
1146
|
+
"annotation": {
|
|
1147
|
+
"type": "keyword",
|
|
1148
|
+
"value": "number"
|
|
1149
|
+
},
|
|
1150
|
+
"optional": true,
|
|
1151
|
+
"computed": false
|
|
1152
|
+
}
|
|
1153
|
+
]
|
|
1058
1154
|
},
|
|
1059
1155
|
{
|
|
1060
1156
|
"type": "typeAlias",
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { DiagramEdge, LineLabelConf,
|
|
2
|
+
import type { DiagramEdge, LineLabelConf, RefRepository, LineLabel, TextOptions } from "./interfaces";
|
|
3
3
|
export interface LineLabelComponentGroupProps {
|
|
4
|
-
labels?:
|
|
4
|
+
labels?: LineLabel[];
|
|
5
5
|
onRendered?: (refRepository: RefRepository | null) => void;
|
|
6
6
|
}
|
|
7
7
|
export declare function LineLabelComponentGroup({ labels, onRendered, }: LineLabelComponentGroupProps): JSX.Element;
|
|
8
8
|
export interface LineTextComponentProps {
|
|
9
9
|
id: string;
|
|
10
10
|
text: TextOptions;
|
|
11
|
-
position: PositionTuple;
|
|
12
11
|
onRendered?: (id: string, element: HTMLElement | null) => void;
|
|
13
12
|
}
|
|
14
|
-
export declare function LineTextComponent({ id, text,
|
|
13
|
+
export declare function LineTextComponent({ id, text, onRendered, }: LineTextComponentProps): JSX.Element;
|
|
15
14
|
export interface LineLabelComponentProps {
|
|
16
15
|
id: string;
|
|
17
16
|
edge: DiagramEdge;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DiagramEdge, DiagramNode, LayoutOptions, RefRepository, RenderedDiagram } from "../interfaces";
|
|
2
|
+
export declare function useRenderedDiagram({ layout, nodes, edges, nodesRefRepository, lineLabelsRefRepository, normalizedLinesMap, nodesRenderId, lineLabelsRenderId, layoutOptions, }: {
|
|
3
|
+
layout: "dagre" | "force" | undefined;
|
|
4
|
+
nodes: DiagramNode[] | undefined;
|
|
5
|
+
edges: DiagramEdge[] | undefined;
|
|
6
|
+
nodesRefRepository: RefRepository | null;
|
|
7
|
+
lineLabelsRefRepository: RefRepository | null;
|
|
8
|
+
normalizedLinesMap: WeakMap<DiagramEdge, string>;
|
|
9
|
+
nodesRenderId: number;
|
|
10
|
+
lineLabelsRenderId: number;
|
|
11
|
+
layoutOptions?: LayoutOptions;
|
|
12
|
+
}): RenderedDiagram;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ReactNextElement } from "@next-core/react-element";
|
|
3
3
|
import "@next-core/theme";
|
|
4
|
-
import type { DiagramEdge, DiagramNode,
|
|
4
|
+
import type { DiagramEdge, DiagramNode, LayoutOptions, LineConf, NodeBrickConf, LineTarget, ConnectLineDetail, NodesConnectOptions, ActiveTarget, RangeTuple } from "./interfaces";
|
|
5
5
|
export interface EoDiagramProps {
|
|
6
|
-
layout?: "dagre";
|
|
6
|
+
layout?: "dagre" | "force";
|
|
7
7
|
nodes?: DiagramNode[];
|
|
8
8
|
edges?: DiagramEdge[];
|
|
9
9
|
nodeBricks?: NodeBrickConf[];
|
|
10
10
|
lines?: LineConf[];
|
|
11
|
-
layoutOptions?:
|
|
11
|
+
layoutOptions?: LayoutOptions;
|
|
12
12
|
nodesConnect?: NodesConnectOptions;
|
|
13
13
|
activeTarget?: ActiveTarget | null;
|
|
14
14
|
disableKeyboardAction?: boolean;
|
|
@@ -29,12 +29,12 @@ export declare class EoDiagram extends ReactNextElement implements EoDiagramProp
|
|
|
29
29
|
/**
|
|
30
30
|
* @required
|
|
31
31
|
*/
|
|
32
|
-
accessor layout: "dagre" | undefined;
|
|
32
|
+
accessor layout: "dagre" | "force" | undefined;
|
|
33
33
|
accessor nodes: DiagramNode[] | undefined;
|
|
34
34
|
accessor edges: DiagramEdge[] | undefined;
|
|
35
35
|
accessor nodeBricks: NodeBrickConf[] | undefined;
|
|
36
36
|
accessor lines: LineConf[] | undefined;
|
|
37
|
-
accessor layoutOptions:
|
|
37
|
+
accessor layoutOptions: LayoutOptions | undefined;
|
|
38
38
|
accessor activeTarget: ActiveTarget | null | undefined;
|
|
39
39
|
accessor disableKeyboardAction: boolean | undefined;
|
|
40
40
|
accessor nodesConnect: NodesConnectOptions | undefined;
|
|
@@ -12,10 +12,6 @@ export interface DiagramEdge {
|
|
|
12
12
|
type?: string;
|
|
13
13
|
[key: string]: unknown;
|
|
14
14
|
}
|
|
15
|
-
export interface RenderedGraph {
|
|
16
|
-
nodes: RenderedNode[];
|
|
17
|
-
edges: RenderedEdge[];
|
|
18
|
-
}
|
|
19
15
|
export interface RenderedNode {
|
|
20
16
|
id: DiagramNodeId;
|
|
21
17
|
x: number;
|
|
@@ -25,10 +21,25 @@ export interface RenderedNode {
|
|
|
25
21
|
data: DiagramNode;
|
|
26
22
|
}
|
|
27
23
|
export interface RenderedEdge {
|
|
28
|
-
|
|
24
|
+
id?: string;
|
|
25
|
+
points?: NodePosition[] | null;
|
|
29
26
|
data: DiagramEdge;
|
|
27
|
+
angle?: number;
|
|
28
|
+
labelpos?: "c" | "l" | "r";
|
|
29
|
+
width?: number;
|
|
30
|
+
height?: number;
|
|
31
|
+
labelSize?: LabelSize;
|
|
32
|
+
}
|
|
33
|
+
export interface LabelSize {
|
|
34
|
+
center?: SizeTuple;
|
|
35
|
+
start?: SizeTuple;
|
|
36
|
+
end?: SizeTuple;
|
|
37
|
+
}
|
|
38
|
+
export interface RenderedDiagram {
|
|
39
|
+
nodes: RenderedNode[];
|
|
40
|
+
edges: RenderedEdge[];
|
|
30
41
|
}
|
|
31
|
-
export interface
|
|
42
|
+
export interface NormalizedLine {
|
|
32
43
|
line: LineConf & {
|
|
33
44
|
strokeColor: string;
|
|
34
45
|
strokeWidth: number;
|
|
@@ -36,10 +47,20 @@ export interface RenderedLine {
|
|
|
36
47
|
curveType: string;
|
|
37
48
|
$id: string;
|
|
38
49
|
};
|
|
39
|
-
d: string;
|
|
40
50
|
markerIndex: number | undefined;
|
|
41
51
|
edge: DiagramEdge;
|
|
42
52
|
}
|
|
53
|
+
export interface LineLabel {
|
|
54
|
+
text?: TextOptions;
|
|
55
|
+
label?: LineLabelConf;
|
|
56
|
+
id: string;
|
|
57
|
+
edge: DiagramEdge;
|
|
58
|
+
}
|
|
59
|
+
export interface RenderedLine extends NormalizedLine {
|
|
60
|
+
d: string;
|
|
61
|
+
angle?: number;
|
|
62
|
+
labelSize?: LabelSize;
|
|
63
|
+
}
|
|
43
64
|
export interface RenderedLineLabel {
|
|
44
65
|
text?: TextOptions;
|
|
45
66
|
label?: LineLabelConf;
|
|
@@ -52,8 +73,13 @@ export interface RenderedLineLabel {
|
|
|
52
73
|
bottom: number;
|
|
53
74
|
};
|
|
54
75
|
id: string;
|
|
76
|
+
lineId: string;
|
|
77
|
+
placement: string;
|
|
78
|
+
angle?: number;
|
|
79
|
+
size?: SizeTuple;
|
|
55
80
|
}
|
|
56
81
|
export type PositionTuple = [x: number, y: number];
|
|
82
|
+
export type SizeTuple = [width: number, height: number];
|
|
57
83
|
export type RangeTuple = [min: number, max: number];
|
|
58
84
|
export interface LineMarker {
|
|
59
85
|
strokeColor: string;
|
|
@@ -81,31 +107,47 @@ export interface LineConf {
|
|
|
81
107
|
interactStrokeWidth?: number;
|
|
82
108
|
curveType?: "curveBasis";
|
|
83
109
|
arrow?: boolean;
|
|
84
|
-
text?: TextOptions;
|
|
85
|
-
label?: LineLabelConf;
|
|
110
|
+
text?: TextOptions | TextOptions[];
|
|
111
|
+
label?: LineLabelConf | LineLabelConf[];
|
|
86
112
|
cursor?: React.CSSProperties["cursor"];
|
|
87
113
|
}
|
|
88
114
|
export interface LineLabelConf {
|
|
89
115
|
if?: string | boolean | null;
|
|
90
116
|
useBrick: UseSingleBrickConf;
|
|
117
|
+
placement?: LineLabelPlacement;
|
|
91
118
|
}
|
|
92
119
|
export interface TextOptions {
|
|
93
120
|
content: string;
|
|
94
121
|
style?: CSSProperties;
|
|
122
|
+
placement?: LineLabelPlacement;
|
|
95
123
|
}
|
|
124
|
+
export type LineLabelPlacement = "center" | "start" | "end";
|
|
96
125
|
export interface TransformLiteral {
|
|
97
126
|
k: number;
|
|
98
127
|
x: number;
|
|
99
128
|
y: number;
|
|
100
129
|
}
|
|
101
|
-
export
|
|
102
|
-
|
|
130
|
+
export type LayoutOptions = LayoutOptionsDagre | LayoutOptionsForce;
|
|
131
|
+
export interface LayoutOptionsDagre extends BaseLayoutOptions {
|
|
103
132
|
rankdir?: "TB" | "BT" | "LR" | "RL";
|
|
104
133
|
ranksep?: number;
|
|
105
134
|
edgesep?: number;
|
|
106
135
|
nodesep?: number;
|
|
107
136
|
align?: "UL" | "UR" | "DL" | "DR";
|
|
108
137
|
}
|
|
138
|
+
export interface LayoutOptionsForce extends BaseLayoutOptions {
|
|
139
|
+
dummyNodesOnEdges?: number;
|
|
140
|
+
collide?: boolean | ForceCollideOptions;
|
|
141
|
+
}
|
|
142
|
+
export interface ForceCollideOptions {
|
|
143
|
+
dummyRadius?: number;
|
|
144
|
+
radiusDiff?: number;
|
|
145
|
+
strength?: number;
|
|
146
|
+
iterations?: number;
|
|
147
|
+
}
|
|
148
|
+
export interface BaseLayoutOptions {
|
|
149
|
+
nodePadding?: PartialRectTuple;
|
|
150
|
+
}
|
|
109
151
|
export type PartialRectTuple = number | [all: number] | [vertical: number, horizontal: number] | [top: number, horizontal: number, bottom: number] | [top: number, right: number, bottom: number, left: number];
|
|
110
152
|
export type FullRectTuple = [
|
|
111
153
|
top: number,
|
|
@@ -114,7 +156,7 @@ export type FullRectTuple = [
|
|
|
114
156
|
left: number
|
|
115
157
|
];
|
|
116
158
|
export interface LineTextClipPath extends SimpleRect {
|
|
117
|
-
|
|
159
|
+
lineId: string;
|
|
118
160
|
}
|
|
119
161
|
export interface SimpleRect {
|
|
120
162
|
x0: number;
|
|
@@ -150,3 +192,13 @@ export interface ActiveTargetOfEdge {
|
|
|
150
192
|
type: "edge";
|
|
151
193
|
edge: DiagramEdge;
|
|
152
194
|
}
|
|
195
|
+
export interface UnifiedGraph {
|
|
196
|
+
layout: string;
|
|
197
|
+
getNode(id: string): RenderedNode | undefined;
|
|
198
|
+
applyLayout(context: ApplyLayoutContext): RenderedDiagram | null;
|
|
199
|
+
}
|
|
200
|
+
export interface ApplyLayoutContext {
|
|
201
|
+
nodesRefRepository: RefRepository;
|
|
202
|
+
lineLabelsRefRepository: RefRepository;
|
|
203
|
+
normalizedLinesMap: WeakMap<DiagramEdge, string>;
|
|
204
|
+
}
|
|
@@ -2,4 +2,4 @@ import type { CurveType, NodePosition } from "../interfaces";
|
|
|
2
2
|
/**
|
|
3
3
|
* Generate Line from points
|
|
4
4
|
*/
|
|
5
|
-
export declare function curveLine(points: Array<NodePosition
|
|
5
|
+
export declare function curveLine(points: Array<NodePosition> | null | undefined, arrowOffset: number, curveType?: CurveType): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|