@railtownai/railtracks-visualizer 0.0.20 → 0.0.22

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.
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import "reactflow/dist/style.css";
2
+ import "@xyflow/react/dist/style.css";
3
3
  import { AgentRun } from "../dto/AgentRun";
4
4
  export interface AgenticFlowVisualizerProps {
5
5
  flowData?: AgentRun | null;
@@ -14,6 +14,7 @@ export interface AgenticFlowVisualizerProps {
14
14
  disableAutoFit?: boolean;
15
15
  showTimeline?: boolean;
16
16
  minNodeSpacing?: number;
17
+ onInspect?: (nodeData: any) => void;
17
18
  }
18
19
  declare const AgenticFlowVisualizer: React.FC<AgenticFlowVisualizerProps>;
19
20
  export default AgenticFlowVisualizer;
@@ -1,13 +1,11 @@
1
1
  import React from "react";
2
- import { AgentRunNode } from "../dto/AgentRunNode";
3
- import { AgentRunEdge } from "../dto/AgentRunEdge";
4
2
  type NodeType = "Tool" | "Agent" | "Coordinator";
5
3
  interface NodeData {
6
4
  label: string;
7
5
  nodeType?: NodeType;
8
- details?: AgentRunNode["details"];
6
+ details?: any;
9
7
  id?: string;
10
- edges?: AgentRunEdge[];
8
+ edges?: any[];
11
9
  edgeDetails?: {
12
10
  input_args?: any[];
13
11
  input_kwargs?: any;
@@ -15,6 +13,7 @@ interface NodeData {
15
13
  state?: string;
16
14
  status?: string;
17
15
  }[];
16
+ onInspect?: (nodeData: NodeData) => void;
18
17
  }
19
18
  interface NodeProps {
20
19
  data: NodeData;
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const ThemeToggle: React.FC;
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ interface NodeData {
3
+ label: string;
4
+ nodeType?: "Tool" | "Agent" | "Coordinator";
5
+ details?: any;
6
+ id?: string;
7
+ edges?: any[];
8
+ edgeDetails?: {
9
+ input_args?: any[];
10
+ input_kwargs?: any;
11
+ output?: any;
12
+ state?: string;
13
+ status?: string;
14
+ }[];
15
+ }
16
+ interface AgentNodeProps {
17
+ data: NodeData;
18
+ id: string;
19
+ onInspect?: (nodeData: NodeData) => void;
20
+ }
21
+ export declare const AgentNode: React.FC<AgentNodeProps>;
22
+ export {};
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ interface NodeData {
3
+ label: string;
4
+ nodeType?: "Tool" | "Agent" | "Coordinator";
5
+ details?: any;
6
+ id?: string;
7
+ edges?: any[];
8
+ edgeDetails?: {
9
+ input_args?: any[];
10
+ input_kwargs?: any;
11
+ output?: any;
12
+ state?: string;
13
+ status?: string;
14
+ }[];
15
+ }
16
+ interface CoordinatorNodeProps {
17
+ data: NodeData;
18
+ id: string;
19
+ onInspect?: (nodeData: NodeData) => void;
20
+ }
21
+ export declare const CoordinatorNode: React.FC<CoordinatorNodeProps>;
22
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ interface ExpandableTextareaProps {
3
+ label: string;
4
+ content: string;
5
+ isExpanded: boolean;
6
+ onToggle: (e?: React.MouseEvent) => void;
7
+ }
8
+ export declare const ExpandableTextarea: React.FC<ExpandableTextareaProps>;
9
+ export {};
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ interface NodeData {
3
+ label: string;
4
+ nodeType?: "Tool" | "Agent" | "Coordinator";
5
+ details?: any;
6
+ id?: string;
7
+ edges?: any[];
8
+ edgeDetails?: {
9
+ input_args?: any[];
10
+ input_kwargs?: any;
11
+ output?: any;
12
+ state?: string;
13
+ status?: string;
14
+ }[];
15
+ }
16
+ interface NodeDetailsPopoverProps {
17
+ isVisible: boolean;
18
+ onClose: () => void;
19
+ nodeData: NodeData;
20
+ triggerRef: React.RefObject<HTMLDivElement>;
21
+ }
22
+ export declare const NodeDetailsPopover: React.FC<NodeDetailsPopoverProps>;
23
+ export {};
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ interface NodeData {
3
+ label: string;
4
+ nodeType?: "Tool" | "Agent" | "Coordinator";
5
+ details?: any;
6
+ id?: string;
7
+ edges?: any[];
8
+ edgeDetails?: {
9
+ input_args?: any[];
10
+ input_kwargs?: any;
11
+ output?: any;
12
+ state?: string;
13
+ status?: string;
14
+ }[];
15
+ }
16
+ interface ToolNodeProps {
17
+ data: NodeData;
18
+ id: string;
19
+ onInspect?: (nodeData: NodeData) => void;
20
+ }
21
+ export declare const ToolNode: React.FC<ToolNodeProps>;
22
+ export {};
@@ -0,0 +1,5 @@
1
+ export { AgentNode } from "./AgentNode";
2
+ export { CoordinatorNode } from "./CoordinatorNode";
3
+ export { ToolNode } from "./ToolNode";
4
+ export { NodeDetailsPopover } from "./NodeDetailsPopover";
5
+ export { ExpandableTextarea } from "./ExpandableTextarea";
@@ -1,6 +1,5 @@
1
1
  export { useApi } from "./useApi";
2
2
  export { useFlowData } from "./useFlowData";
3
- export { useTheme } from "./useTheme";
4
3
  export type { JsonFile, ApiError } from "./useApi";
5
4
  export type { FlowDataState } from "./useFlowData";
6
5
  export type { AgentRunNode } from "../dto/AgentRunNode";
@@ -15,3 +15,5 @@ export type { AgentRunNode } from "./dto/AgentRunNode";
15
15
  export type { AgentRunEdge } from "./dto/AgentRunEdge";
16
16
  export { OpenAIIcon, AnthropicIcon, GoogleIcon } from "./components/icons";
17
17
  export * from "./lib";
18
+ export { SafeThemeProvider, useSafeTheme } from "./lib/SafeThemeProvider";
19
+ export { createSafeTheme, getSafeColor, getSafeSpacing, getSafeThemeValue } from "./lib/utils";
@@ -0,0 +1,19 @@
1
+ import React, { ReactNode } from "react";
2
+ import { Theme } from "./theme";
3
+ interface SafeThemeProviderProps {
4
+ children: ReactNode;
5
+ theme?: Theme;
6
+ fallbackTheme?: Theme;
7
+ }
8
+ /**
9
+ * Safe Theme Provider that ensures components always have access to a valid theme
10
+ * This prevents the "Cannot read properties of undefined (reading 'card')" error
11
+ * when the package is used in applications that don't provide a theme context
12
+ */
13
+ export declare const SafeThemeProvider: React.FC<SafeThemeProviderProps>;
14
+ /**
15
+ * Hook that provides a safe theme context
16
+ * Returns a theme object that is guaranteed to have all required properties
17
+ */
18
+ export declare const useSafeTheme: () => Theme;
19
+ export {};
@@ -3,6 +3,7 @@ import { Theme } from "./theme";
3
3
  interface ThemeContextType {
4
4
  theme: Theme;
5
5
  setTheme: (theme: Theme) => void;
6
+ isDarkMode: boolean;
6
7
  }
7
8
  interface ThemeProviderProps {
8
9
  children: ReactNode;
@@ -3,3 +3,5 @@ export * from "./layout";
3
3
  export * from "./theme";
4
4
  export * from "./ThemeProvider";
5
5
  export * from "./GlobalStyles";
6
+ export * from "./SafeThemeProvider";
7
+ export * from "./safeStyled";
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Safe styled-components wrapper that prevents undefined theme errors
3
+ * This wrapper ensures that styled components always have access to a valid theme
4
+ */
5
+ export declare const safeStyled: {
6
+ div: (template: TemplateStringsArray, ...args: any[]) => import("@emotion/styled").StyledComponent<{
7
+ theme?: import("@emotion/react").Theme;
8
+ as?: React.ElementType;
9
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
10
+ button: (template: TemplateStringsArray, ...args: any[]) => import("@emotion/styled").StyledComponent<{
11
+ theme?: import("@emotion/react").Theme;
12
+ as?: React.ElementType;
13
+ }, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
14
+ span: (template: TemplateStringsArray, ...args: any[]) => import("@emotion/styled").StyledComponent<{
15
+ theme?: import("@emotion/react").Theme;
16
+ as?: React.ElementType;
17
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
18
+ h3: (template: TemplateStringsArray, ...args: any[]) => import("@emotion/styled").StyledComponent<{
19
+ theme?: import("@emotion/react").Theme;
20
+ as?: React.ElementType;
21
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, {}>;
22
+ textarea: (template: TemplateStringsArray, ...args: any[]) => import("@emotion/styled").StyledComponent<{
23
+ theme?: import("@emotion/react").Theme;
24
+ as?: React.ElementType;
25
+ }, import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, {}>;
26
+ };
27
+ /**
28
+ * Safe theme color accessor for styled-components
29
+ * Usage: color: ${safeThemeColor('card')}
30
+ */
31
+ export declare const safeThemeColor: (colorKey: string, fallback?: string) => (props: any) => string;
32
+ /**
33
+ * Safe theme spacing accessor for styled-components
34
+ * Usage: padding: ${safeThemeSpacing('md')}
35
+ */
36
+ export declare const safeThemeSpacing: (spacingKey: string, fallback?: string) => (props: any) => string;
37
+ /**
38
+ * Safe theme value accessor for styled-components
39
+ * Usage: box-shadow: ${safeThemeValue('shadows.md', 'none')}
40
+ */
41
+ export declare const safeThemeValue: (path: string, fallback?: any) => (props: any) => string;
@@ -47,3 +47,33 @@ export declare function getSpacing(theme: any, size: keyof typeof theme.spacing)
47
47
  * @returns The color value
48
48
  */
49
49
  export declare function getColor(theme: any, colorKey: keyof typeof theme.colors): string;
50
+ /**
51
+ * Safe theme access utility - prevents undefined theme errors
52
+ * @param theme - The theme object (can be undefined)
53
+ * @param colorKey - The color key to access
54
+ * @param fallback - Fallback color if theme or color is undefined
55
+ * @returns The color value or fallback
56
+ */
57
+ export declare function getSafeColor(theme: any, colorKey: string, fallback?: string): string;
58
+ /**
59
+ * Safe theme access utility for spacing
60
+ * @param theme - The theme object (can be undefined)
61
+ * @param spacingKey - The spacing key to access
62
+ * @param fallback - Fallback spacing if theme or spacing is undefined
63
+ * @returns The spacing value or fallback
64
+ */
65
+ export declare function getSafeSpacing(theme: any, spacingKey: string, fallback?: string): string;
66
+ /**
67
+ * Safe theme access utility for any theme property
68
+ * @param theme - The theme object (can be undefined)
69
+ * @param path - The path to the property (e.g., 'colors.card', 'spacing.md')
70
+ * @param fallback - Fallback value if theme or property is undefined
71
+ * @returns The property value or fallback
72
+ */
73
+ export declare function getSafeThemeValue(theme: any, path: string, fallback: any): any;
74
+ /**
75
+ * Creates a safe theme object with fallbacks for all required properties
76
+ * @param theme - The theme object (can be undefined)
77
+ * @returns A safe theme object with fallbacks
78
+ */
79
+ export declare function createSafeTheme(theme?: any): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@railtownai/railtracks-visualizer",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Railtown AI",
6
6
  "description": "A visualizer for RailTracks agentic flows",
@@ -42,8 +42,9 @@
42
42
  "@radix-ui/react-checkbox": "1.3.3",
43
43
  "@radix-ui/react-dialog": "1.1.15",
44
44
  "@radix-ui/react-select": "2.2.6",
45
+ "@xyflow/react": "12.8.4",
45
46
  "lucide-react": "0.525.0",
46
- "reactflow": "11.11.4",
47
+ "react-countup": "6.5.3",
47
48
  "vaul": "1.1.2"
48
49
  },
49
50
  "scripts": {
@@ -61,7 +62,7 @@
61
62
  "storybook:preview": "npx http-server ./storybook-static",
62
63
  "storybook:deploy": "gh-pages -d storybook-static",
63
64
  "test:ui": "vitest --ui",
64
- "test": "vitest run",
65
+ "test": "vitest run --silent",
65
66
  "up": "ncu -u -x react -x react-dom -x @types/react -x @types/react-dom && npm install"
66
67
  },
67
68
  "devDependencies": {
@@ -1,7 +0,0 @@
1
- import { Theme } from "../lib/theme";
2
- export declare const useTheme: () => {
3
- isDarkMode: boolean;
4
- theme: Theme;
5
- toggleTheme: () => void;
6
- setTheme: (theme: "light" | "dark") => void;
7
- };