Skip to content

Commit 8b39b84

Browse files
committed
docs(ui): Update README for integrated debug controls API
Update documentation to reflect the new debugConfig prop API which replaces the previous debugMode + external DebuggerProvider pattern.
1 parent 5943977 commit 8b39b84

File tree

1 file changed

+43
-15
lines changed

1 file changed

+43
-15
lines changed

ui/README.md

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,33 +82,52 @@ interface WorkflowVisualizerProps {
8282
theme?: 'light' | 'dark' | 'system';
8383
className?: string;
8484
executionResult?: Message | null;
85-
debugMode?: boolean;
85+
debugConfig?: DebugConfig;
86+
debugPayload?: Record<string, unknown>;
87+
}
88+
89+
interface DebugConfig {
90+
enabled: boolean;
91+
engineFactory?: EngineFactory;
92+
initialPayload?: Record<string, unknown>;
93+
autoExecute?: boolean;
94+
onExecutionComplete?: (trace: ExecutionTrace) => void;
95+
onExecutionError?: (error: string) => void;
8696
}
8797
```
8898

8999
### Debug Mode
90100

91-
Enable step-by-step execution visualization:
101+
Enable step-by-step execution visualization with integrated debug controls:
92102

93103
```tsx
94-
import { WorkflowVisualizer, DebuggerProvider, DebuggerControls, defaultEngineFactory } from '@goplasmatic/dataflow-ui';
104+
import { WorkflowVisualizer, defaultEngineFactory } from '@goplasmatic/dataflow-ui';
95105

96106
function DebugView() {
107+
const payload = { data: { input: 'hello' } };
108+
97109
return (
98-
<DebuggerProvider engineFactory={defaultEngineFactory}>
99-
<WorkflowVisualizer workflows={workflows} debugMode={true} />
100-
<DebuggerControls />
101-
</DebuggerProvider>
110+
<WorkflowVisualizer
111+
workflows={workflows}
112+
debugConfig={{
113+
enabled: true,
114+
engineFactory: defaultEngineFactory,
115+
autoExecute: true,
116+
}}
117+
debugPayload={payload}
118+
/>
102119
);
103120
}
104121
```
105122

123+
The debug controls (play, pause, step forward/backward) are automatically displayed in the visualizer header when `debugConfig.enabled` is true.
124+
106125
### Custom WASM Engine
107126

108127
Use a custom WASM engine with plugins or custom functions:
109128

110129
```tsx
111-
import { WorkflowVisualizer, DebuggerProvider, DataflowEngine } from '@goplasmatic/dataflow-ui';
130+
import { WorkflowVisualizer, DataflowEngine, EngineFactory } from '@goplasmatic/dataflow-ui';
112131
import { MyCustomWasmEngine } from './my-custom-wasm';
113132

114133
// Implement the DataflowEngine interface
@@ -129,22 +148,29 @@ class MyEngineAdapter implements DataflowEngine {
129148
}
130149
}
131150

151+
const customEngineFactory: EngineFactory = (workflows) => new MyEngineAdapter(workflows);
152+
132153
function CustomDebugView() {
133154
return (
134-
<DebuggerProvider engineFactory={(workflows) => new MyEngineAdapter(workflows)}>
135-
<WorkflowVisualizer workflows={workflows} debugMode={true} />
136-
</DebuggerProvider>
155+
<WorkflowVisualizer
156+
workflows={workflows}
157+
debugConfig={{
158+
enabled: true,
159+
engineFactory: customEngineFactory,
160+
autoExecute: true,
161+
}}
162+
debugPayload={{ data: { input: 'test' } }}
163+
/>
137164
);
138165
}
139166
```
140167

141168
## Exports
142169

143170
### Components
144-
- `WorkflowVisualizer` - Main visualization component
171+
- `WorkflowVisualizer` - Main visualization component with integrated debug controls
145172
- `TreeView` - Standalone tree view
146-
- `DebuggerControls` - Debug playback controls
147-
- `DebuggerProvider` - Debug state context provider
173+
- `DebuggerProvider` - Debug state context provider (for advanced use cases)
148174

149175
### Hooks
150176
- `useTheme` - Access theme state
@@ -158,7 +184,9 @@ function CustomDebugView() {
158184
- `EngineFactory` - Type for engine factory functions
159185

160186
### Types
161-
All TypeScript types are exported for workflow definitions, tasks, messages, and execution traces.
187+
- `Workflow`, `Task`, `Message` - Core workflow types
188+
- `ExecutionTrace`, `ExecutionStep` - Execution trace types
189+
- `DebugConfig` - Debug mode configuration
162190

163191
## Peer Dependencies
164192

0 commit comments

Comments
 (0)