@aiready/components 0.1.7 → 0.1.8
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/charts/ForceDirectedGraph.d.ts +15 -6
- package/dist/charts/ForceDirectedGraph.js +112 -452
- package/dist/charts/ForceDirectedGraph.js.map +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +98 -171
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/charts/ForceDirectedGraph.tsx +148 -234
- package/src/index.ts +2 -0
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import { SimulationNode, SimulationLink, ForceSimulationOptions } from '../hooks/useForceSimulation.js';
|
|
3
|
-
import 'd3';
|
|
4
2
|
|
|
5
|
-
interface GraphNode
|
|
3
|
+
interface GraphNode {
|
|
6
4
|
id: string;
|
|
7
5
|
label?: string;
|
|
8
6
|
color?: string;
|
|
@@ -10,12 +8,20 @@ interface GraphNode extends SimulationNode {
|
|
|
10
8
|
group?: string;
|
|
11
9
|
kind?: 'file' | 'package';
|
|
12
10
|
packageGroup?: string;
|
|
11
|
+
x?: number;
|
|
12
|
+
y?: number;
|
|
13
|
+
fx?: number | null;
|
|
14
|
+
fy?: number | null;
|
|
13
15
|
}
|
|
14
|
-
interface GraphLink
|
|
16
|
+
interface GraphLink {
|
|
17
|
+
source: string | GraphNode;
|
|
18
|
+
target: string | GraphNode;
|
|
15
19
|
color?: string;
|
|
16
20
|
width?: number;
|
|
17
21
|
label?: string;
|
|
22
|
+
type?: string;
|
|
18
23
|
}
|
|
24
|
+
type LayoutType = 'force' | 'hierarchical' | 'circular';
|
|
19
25
|
interface ForceDirectedGraphHandle {
|
|
20
26
|
pinAll: () => void;
|
|
21
27
|
unpinAll: () => void;
|
|
@@ -23,13 +29,14 @@ interface ForceDirectedGraphHandle {
|
|
|
23
29
|
fitView: () => void;
|
|
24
30
|
getPinnedNodes: () => string[];
|
|
25
31
|
setDragMode: (enabled: boolean) => void;
|
|
32
|
+
setLayout: (layout: LayoutType) => void;
|
|
33
|
+
getLayout: () => LayoutType;
|
|
26
34
|
}
|
|
27
35
|
interface ForceDirectedGraphProps {
|
|
28
36
|
nodes: GraphNode[];
|
|
29
37
|
links: GraphLink[];
|
|
30
38
|
width: number;
|
|
31
39
|
height: number;
|
|
32
|
-
simulationOptions?: Partial<ForceSimulationOptions>;
|
|
33
40
|
enableZoom?: boolean;
|
|
34
41
|
enableDrag?: boolean;
|
|
35
42
|
onNodeClick?: (node: GraphNode) => void;
|
|
@@ -51,7 +58,9 @@ interface ForceDirectedGraphProps {
|
|
|
51
58
|
y: number;
|
|
52
59
|
r: number;
|
|
53
60
|
}>;
|
|
61
|
+
layout?: LayoutType;
|
|
62
|
+
onLayoutChange?: (layout: LayoutType) => void;
|
|
54
63
|
}
|
|
55
64
|
declare const ForceDirectedGraph: React__default.ForwardRefExoticComponent<ForceDirectedGraphProps & React__default.RefAttributes<ForceDirectedGraphHandle>>;
|
|
56
65
|
|
|
57
|
-
export { ForceDirectedGraph, type ForceDirectedGraphHandle, type ForceDirectedGraphProps, type GraphLink, type GraphNode };
|
|
66
|
+
export { ForceDirectedGraph, type ForceDirectedGraphHandle, type ForceDirectedGraphProps, type GraphLink, type GraphNode, type LayoutType };
|