@goplasmatic/dataflow-ui 2.0.4 → 2.0.6
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 +46 -3
- package/dist/index.cjs +547 -77
- package/dist/index.d.ts +44 -1
- package/dist/index.js +547 -77
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -17,10 +17,12 @@ A React component library for visualizing and debugging [dataflow-rs](https://gi
|
|
|
17
17
|
## Features
|
|
18
18
|
|
|
19
19
|
- **Workflow Visualization** - Interactive tree view of workflows, tasks, and conditions
|
|
20
|
-
- **Execution Debugging** - Step-by-step execution trace visualization with
|
|
20
|
+
- **Execution Debugging** - Step-by-step execution trace visualization with message snapshots
|
|
21
21
|
- **JSONLogic Viewer** - Visual representation of JSONLogic expressions via [@goplasmatic/datalogic-ui](https://www.npmjs.com/package/@goplasmatic/datalogic-ui)
|
|
22
22
|
- **Theme Support** - Light, dark, and system theme modes
|
|
23
23
|
- **TypeScript** - Full type definitions included
|
|
24
|
+
- **Monaco Editor Integration** - JSON editing with syntax highlighting
|
|
25
|
+
- **Change Highlighting** - Visual diff of message changes at each step
|
|
24
26
|
|
|
25
27
|
## Installation
|
|
26
28
|
|
|
@@ -89,11 +91,11 @@ interface WorkflowVisualizerProps {
|
|
|
89
91
|
Enable step-by-step execution visualization:
|
|
90
92
|
|
|
91
93
|
```tsx
|
|
92
|
-
import { WorkflowVisualizer, DebuggerProvider, DebuggerControls } from '@goplasmatic/dataflow-ui';
|
|
94
|
+
import { WorkflowVisualizer, DebuggerProvider, DebuggerControls, defaultEngineFactory } from '@goplasmatic/dataflow-ui';
|
|
93
95
|
|
|
94
96
|
function DebugView() {
|
|
95
97
|
return (
|
|
96
|
-
<DebuggerProvider>
|
|
98
|
+
<DebuggerProvider engineFactory={defaultEngineFactory}>
|
|
97
99
|
<WorkflowVisualizer workflows={workflows} debugMode={true} />
|
|
98
100
|
<DebuggerControls />
|
|
99
101
|
</DebuggerProvider>
|
|
@@ -101,6 +103,41 @@ function DebugView() {
|
|
|
101
103
|
}
|
|
102
104
|
```
|
|
103
105
|
|
|
106
|
+
### Custom WASM Engine
|
|
107
|
+
|
|
108
|
+
Use a custom WASM engine with plugins or custom functions:
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
import { WorkflowVisualizer, DebuggerProvider, DataflowEngine } from '@goplasmatic/dataflow-ui';
|
|
112
|
+
import { MyCustomWasmEngine } from './my-custom-wasm';
|
|
113
|
+
|
|
114
|
+
// Implement the DataflowEngine interface
|
|
115
|
+
class MyEngineAdapter implements DataflowEngine {
|
|
116
|
+
private engine: MyCustomWasmEngine;
|
|
117
|
+
|
|
118
|
+
constructor(workflows: Workflow[]) {
|
|
119
|
+
this.engine = new MyCustomWasmEngine(JSON.stringify(workflows));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async processWithTrace(payload: Record<string, unknown>) {
|
|
123
|
+
const result = await this.engine.process_with_trace(JSON.stringify(payload));
|
|
124
|
+
return JSON.parse(result);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
dispose() {
|
|
128
|
+
this.engine.free();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function CustomDebugView() {
|
|
133
|
+
return (
|
|
134
|
+
<DebuggerProvider engineFactory={(workflows) => new MyEngineAdapter(workflows)}>
|
|
135
|
+
<WorkflowVisualizer workflows={workflows} debugMode={true} />
|
|
136
|
+
</DebuggerProvider>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
104
141
|
## Exports
|
|
105
142
|
|
|
106
143
|
### Components
|
|
@@ -114,6 +151,12 @@ function DebugView() {
|
|
|
114
151
|
- `useDebugger` - Access debugger state and controls
|
|
115
152
|
- `useTaskDebugState` - Get debug state for a specific task
|
|
116
153
|
|
|
154
|
+
### Engine
|
|
155
|
+
- `WasmEngineAdapter` - Default WASM engine adapter
|
|
156
|
+
- `defaultEngineFactory` - Factory function for default engine
|
|
157
|
+
- `DataflowEngine` - Interface for custom engines
|
|
158
|
+
- `EngineFactory` - Type for engine factory functions
|
|
159
|
+
|
|
117
160
|
### Types
|
|
118
161
|
All TypeScript types are exported for workflow definitions, tasks, messages, and execution traces.
|
|
119
162
|
|