@cyvest/cyvest-vis 2.0.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.
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # @cyvest/cyvest-vis
2
+
3
+ React components for visualizing Cyvest investigations using XYFlow + D3 layouts.
4
+
5
+ ## What it does
6
+
7
+ - Renders observables, relationships, checks, and containers as an interactive graph.
8
+ - Uses `@cyvest/cyvest-js` helpers for level colors, graph data, and schema-safe types.
9
+ - Ships CJS, ESM, and type definitions for React 18+ projects.
10
+
11
+ ## Install & build
12
+
13
+ ```bash
14
+ pnpm install # from repo root
15
+ pnpm --filter @cyvest/cyvest-vis build
16
+ ```
17
+
18
+ Run tests:
19
+
20
+ ```bash
21
+ pnpm --filter @cyvest/cyvest-vis test
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ```tsx
27
+ import { CyvestGraph } from "@cyvest/cyvest-vis";
28
+ import type { CyvestInvestigation } from "@cyvest/cyvest-js";
29
+
30
+ export function InvestigationView({ investigation }: { investigation: CyvestInvestigation }) {
31
+ return (
32
+ <CyvestGraph
33
+ investigation={investigation}
34
+ height={520}
35
+ showViewToggle
36
+ onNodeClick={(id) => console.log("Selected", id)}
37
+ />
38
+ );
39
+ }
40
+ ```
41
+
42
+ Props include `height`, `width`, `showViewToggle`, `onNodeClick`, and optional control over zoom/pan behaviour. See `src/components` for more advanced hooks and utilities.
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import * as _cyvest_cyvest_js from '@cyvest/cyvest-js';
3
+
4
+ /**
5
+ * Configuration options for d3-force layout.
6
+ */
7
+ interface ForceLayoutConfig {
8
+ /** Strength of the charge force (repulsion). Default: -300 */
9
+ chargeStrength: number;
10
+ /** Target distance between linked nodes. Default: 100 */
11
+ linkDistance: number;
12
+ /** Strength of the centering force. Default: 0.1 */
13
+ centerStrength: number;
14
+ /** Strength of the collision force. Default: 30 */
15
+ collisionRadius: number;
16
+ /** Number of simulation iterations. Default: 300 */
17
+ iterations: number;
18
+ }
19
+ /**
20
+ * Props for the CyvestGraph component (combined view).
21
+ */
22
+ interface CyvestGraphProps {
23
+ /** The Cyvest investigation to visualize */
24
+ investigation: _cyvest_cyvest_js.CyvestInvestigation;
25
+ /** Height of the graph container */
26
+ height?: number | string;
27
+ /** Width of the graph container */
28
+ width?: number | string;
29
+ /** Initial view to display */
30
+ initialView?: "observables" | "investigation";
31
+ /** Callback when a node is clicked */
32
+ onNodeClick?: (nodeId: string) => void;
33
+ /** Custom class name for the container */
34
+ className?: string;
35
+ /** Whether to show view toggle */
36
+ showViewToggle?: boolean;
37
+ }
38
+
39
+ /**
40
+ * CyvestGraph component - combined view with toggle between observables and investigation views.
41
+ */
42
+
43
+ /**
44
+ * CyvestGraph component - provides toggle between ObservablesGraph and InvestigationGraph.
45
+ */
46
+ declare const CyvestGraph: React.FC<CyvestGraphProps>;
47
+
48
+ export { CyvestGraph, type CyvestGraphProps, type ForceLayoutConfig };
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import * as _cyvest_cyvest_js from '@cyvest/cyvest-js';
3
+
4
+ /**
5
+ * Configuration options for d3-force layout.
6
+ */
7
+ interface ForceLayoutConfig {
8
+ /** Strength of the charge force (repulsion). Default: -300 */
9
+ chargeStrength: number;
10
+ /** Target distance between linked nodes. Default: 100 */
11
+ linkDistance: number;
12
+ /** Strength of the centering force. Default: 0.1 */
13
+ centerStrength: number;
14
+ /** Strength of the collision force. Default: 30 */
15
+ collisionRadius: number;
16
+ /** Number of simulation iterations. Default: 300 */
17
+ iterations: number;
18
+ }
19
+ /**
20
+ * Props for the CyvestGraph component (combined view).
21
+ */
22
+ interface CyvestGraphProps {
23
+ /** The Cyvest investigation to visualize */
24
+ investigation: _cyvest_cyvest_js.CyvestInvestigation;
25
+ /** Height of the graph container */
26
+ height?: number | string;
27
+ /** Width of the graph container */
28
+ width?: number | string;
29
+ /** Initial view to display */
30
+ initialView?: "observables" | "investigation";
31
+ /** Callback when a node is clicked */
32
+ onNodeClick?: (nodeId: string) => void;
33
+ /** Custom class name for the container */
34
+ className?: string;
35
+ /** Whether to show view toggle */
36
+ showViewToggle?: boolean;
37
+ }
38
+
39
+ /**
40
+ * CyvestGraph component - combined view with toggle between observables and investigation views.
41
+ */
42
+
43
+ /**
44
+ * CyvestGraph component - provides toggle between ObservablesGraph and InvestigationGraph.
45
+ */
46
+ declare const CyvestGraph: React.FC<CyvestGraphProps>;
47
+
48
+ export { CyvestGraph, type CyvestGraphProps, type ForceLayoutConfig };