@cyvest/cyvest-vis 5.2.0 → 5.3.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/README.md CHANGED
@@ -1,20 +1,20 @@
1
1
  # @cyvest/cyvest-vis
2
2
 
3
- React components for visualizing Cyvest investigations using React Flow + D3 force layouts.
3
+ Cytoscape-based React components for rendering Cyvest investigations.
4
4
 
5
- ## Features
5
+ ## Highlights
6
6
 
7
- - **Two visualization modes**: Observables graph (force-directed) and Investigation graph (hierarchical Dagre layout)
8
- - **Interactive force simulation**: Drag nodes, adjust forces in real-time
9
- - **Professional SVG icons**: Clean icons for all observable types (IPs, domains, emails, files, threats, etc.)
10
- - **Level-aware styling**: Nodes colored by security level (SAFE, INFORMATIVE, SUSPICIOUS, MALICIOUS)
11
- - **Responsive design**: Works at any size with zoom, pan, and minimap controls
12
- - Uses `@cyvest/cyvest-js` for types, colors, and graph data extraction
7
+ - Built on `@cyvest/cyvest-js` investigation and graph helpers
8
+ - Two views: observables graph and investigation hierarchy
9
+ - Layouts: ELK `stress` for observables, Dagre `LR` for investigation
10
+ - Professional built-in SVG icons for nodes
11
+ - Label truncation with full-value events
12
+ - Themeable with CSS variables and typed React props
13
13
 
14
- ## Installation
14
+ ## Install / Build
15
15
 
16
16
  ```bash
17
- pnpm install # from repo root
17
+ pnpm install
18
18
  pnpm --filter @cyvest/cyvest-vis build
19
19
  ```
20
20
 
@@ -26,129 +26,50 @@ pnpm --filter @cyvest/cyvest-vis test
26
26
 
27
27
  ## Usage
28
28
 
29
- ### Basic Usage
30
-
31
29
  ```tsx
32
30
  import { CyvestGraph } from "@cyvest/cyvest-vis";
33
- import type { CyvestInvestigation } from "@cyvest/cyvest-js";
34
-
35
- function InvestigationView({ investigation }: { investigation: CyvestInvestigation }) {
36
- return (
37
- <CyvestGraph
38
- investigation={investigation}
39
- height={600}
40
- showViewToggle
41
- onNodeClick={(id) => console.log("Selected:", id)}
42
- />
43
- );
44
- }
45
- ```
46
-
47
- ### Components
48
-
49
- #### `CyvestGraph`
31
+ import "@cyvest/cyvest-vis/styles.css";
50
32
 
51
- Main component with toggle between Observables and Investigation views.
52
-
53
- ```tsx
54
33
  <CyvestGraph
55
34
  investigation={investigation}
56
- height={600}
57
- width="100%"
58
- initialView="observables" // or "investigation"
59
- showViewToggle={true}
60
- onNodeClick={(nodeId) => {}}
61
- />
62
- ```
63
-
64
- #### `ObservablesGraph`
65
-
66
- Force-directed graph showing all observables and their relationships.
67
-
68
- ```tsx
69
- import { ObservablesGraph } from "@cyvest/cyvest-vis";
70
-
71
- <ObservablesGraph
72
- investigation={investigation}
73
- height={600}
74
- width="100%"
75
- showControls={true} // Show force layout controls
76
- forceConfig={{
77
- chargeStrength: -200,
78
- linkDistance: 80,
79
- collisionRadius: 45,
80
- }}
81
- onNodeClick={(nodeId) => {}}
82
- onNodeDoubleClick={(nodeId) => {}}
83
- />
84
- ```
85
-
86
- #### `InvestigationGraph`
87
-
88
- Hierarchical graph showing root → tags → checks structure.
89
-
90
- ```tsx
91
- import { InvestigationGraph } from "@cyvest/cyvest-vis";
92
-
93
- <InvestigationGraph
94
- investigation={investigation}
95
- height={600}
96
- width="100%"
97
- onNodeClick={(nodeId, nodeType) => {
98
- // nodeType: "root" | "check" | "tag"
35
+ height={620}
36
+ initialView="observables"
37
+ onNodeSelect={(event) => {
38
+ console.log(event.nodeId, event.label, event.nodeType);
99
39
  }}
100
40
  />
101
41
  ```
102
42
 
103
- ### Custom Icons
104
-
105
- Access icon components for custom UIs:
106
-
107
- ```tsx
108
- import { getObservableIcon, getInvestigationIcon, GlobeIcon, MailIcon } from "@cyvest/cyvest-vis";
109
-
110
- // Get icon by observable type
111
- const Icon = getObservableIcon("ipv4"); // Returns GlobeIcon
112
- <Icon size={24} color="#3b82f6" />
113
-
114
- // Or use icons directly
115
- <GlobeIcon size={16} color="currentColor" />
116
- <MailIcon size={16} color="#ef4444" />
117
- ```
118
-
119
- Available icons: `GlobeIcon`, `DomainIcon`, `LinkIcon`, `MailIcon`, `EnvelopeIcon`, `FileIcon`, `HashIcon`, `UserIcon`, `IdCardIcon`, `GearIcon`, `AppIcon`, `RegistryIcon`, `ThreatActorIcon`, `BugIcon`, `SwordIcon`, `TargetIcon`, `AlertIcon`, `FlaskIcon`, `CertificateIcon`, `WifiIcon`, `WorldIcon`, `QuestionIcon`, `CheckIcon`, `TagIcon`, `CrosshairIcon`
120
-
121
- ## Types
122
-
123
- ```tsx
124
- import type {
125
- CyvestGraphProps,
126
- ObservablesGraphProps,
127
- InvestigationGraphProps,
128
- ForceLayoutConfig,
129
- ObservableNodeData,
130
- InvestigationNodeData,
131
- InvestigationNodeType,
132
- } from "@cyvest/cyvest-vis";
133
- ```
134
-
135
- ### Force Layout Configuration
136
-
137
- ```tsx
138
- interface ForceLayoutConfig {
139
- chargeStrength: number; // Repulsion strength (default: -200)
140
- linkDistance: number; // Target link distance (default: 80)
141
- centerStrength: number; // Center pull strength (default: 0.05)
142
- collisionRadius: number; // Node collision radius (default: 45)
143
- iterations: number; // Iterations for static layout (default: 300)
43
+ ## Main Exports
44
+
45
+ - `CyvestGraph`
46
+ - `CyvestObservablesView`
47
+ - `CyvestInvestigationView`
48
+ - `createElkLayout`
49
+ - `truncateLabel`
50
+ - `getObservableIconSvg`
51
+ - `getInvestigationIconSvg`
52
+
53
+ ## Theming
54
+
55
+ Use the `theme` prop or override CSS variables.
56
+
57
+ ```css
58
+ :root {
59
+ --cyvest-background: #f4f7fb;
60
+ --cyvest-grid-color: #d7dfeb;
61
+ --cyvest-panel-bg: rgba(255, 255, 255, 0.96);
62
+ --cyvest-panel-border: #d3dae6;
63
+ --cyvest-panel-text: #172033;
64
+ --cyvest-panel-muted: #556079;
65
+ --cyvest-accent: #1f6feb;
66
+ --cyvest-font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif;
144
67
  }
145
68
  ```
146
69
 
147
- ## Peer Dependencies
148
-
149
- - React 19+
150
- - React DOM 19+
151
-
152
- ## License
70
+ ## Breaking Changes vs v1
153
71
 
154
- See repository root for license information.
72
+ - Rendering engine changed from React Flow to Cytoscape.
73
+ - Events moved to `onNodeSelect` / `onEdgeSelect`.
74
+ - Component names are now `CyvestObservablesView` and `CyvestInvestigationView`.
75
+ - Import stylesheet with `@cyvest/cyvest-vis/styles.css`.