@runtypelabs/react-flow 1.0.39 → 1.0.41
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/CHANGELOG.md +15 -0
- package/dist/index.js +0 -5
- package/example/CHANGELOG.md +17 -0
- package/example/package.json +1 -1
- package/example/src/App.tsx +0 -58
- package/package.json +2 -2
- package/src/components/RuntypeFlowEditor.tsx +0 -21
- package/src/components/nodes/BaseNode.tsx +4 -20
- package/src/components/nodes/CodeNode.tsx +0 -6
- package/src/components/nodes/ConditionalNode.tsx +0 -9
- package/src/components/nodes/FetchUrlNode.tsx +0 -9
- package/src/components/nodes/PromptNode.tsx +0 -6
- package/src/components/nodes/SendEmailNode.tsx +0 -7
- package/src/hooks/useFlowValidation.ts +0 -36
- package/src/hooks/useRuntypeFlow.ts +0 -42
- package/src/index.ts +0 -4
- package/src/types/index.ts +0 -18
- package/src/utils/adapter.ts +1 -53
- package/src/utils/layout.ts +0 -23
- package/tsup.config.ts +0 -2
- package/.turbo/turbo-build.log +0 -13
- package/dist/index.mjs +0 -3334
- package/example/node_modules/.bin/tsc +0 -43
- package/example/node_modules/.bin/tsserver +0 -43
- package/example/node_modules/.bin/vite +0 -43
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @runtypelabs/react-flow
|
|
2
2
|
|
|
3
|
+
## 1.0.41
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [ccd07e2]
|
|
8
|
+
- Updated dependencies [8ab7d4a]
|
|
9
|
+
- @runtypelabs/sdk@9.3.2
|
|
10
|
+
|
|
11
|
+
## 1.0.40
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [95e48e6]
|
|
16
|
+
- @runtypelabs/sdk@9.3.1
|
|
17
|
+
|
|
3
18
|
## 1.0.39
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -830,26 +830,22 @@ function useRuntypeFlow(options) {
|
|
|
830
830
|
}
|
|
831
831
|
}, [nodes]);
|
|
832
832
|
return {
|
|
833
|
-
// React Flow state
|
|
834
833
|
nodes,
|
|
835
834
|
edges,
|
|
836
835
|
onNodesChange,
|
|
837
836
|
onEdgesChange,
|
|
838
837
|
onConnect: handleConnect,
|
|
839
|
-
// Flow metadata
|
|
840
838
|
flowName,
|
|
841
839
|
flowDescription,
|
|
842
840
|
flowId,
|
|
843
841
|
setFlowName,
|
|
844
842
|
setFlowDescription,
|
|
845
|
-
// API operations
|
|
846
843
|
loadFlow,
|
|
847
844
|
saveFlow,
|
|
848
845
|
createFlow,
|
|
849
846
|
deleteStep,
|
|
850
847
|
updateStep,
|
|
851
848
|
addStep,
|
|
852
|
-
// Status
|
|
853
849
|
isLoading,
|
|
854
850
|
isSaving,
|
|
855
851
|
error,
|
|
@@ -2961,7 +2957,6 @@ var nodeTypes = {
|
|
|
2961
2957
|
"transform-data": CodeNode,
|
|
2962
2958
|
conditional: ConditionalNode,
|
|
2963
2959
|
"send-email": SendEmailNode,
|
|
2964
|
-
// Default node for unsupported types
|
|
2965
2960
|
default: DefaultNode
|
|
2966
2961
|
};
|
|
2967
2962
|
function DefaultNode(props) {
|
package/example/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @runtypelabs/react-flow-example
|
|
2
2
|
|
|
3
|
+
## 0.0.167
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [ccd07e2]
|
|
8
|
+
- Updated dependencies [8ab7d4a]
|
|
9
|
+
- @runtypelabs/sdk@9.3.2
|
|
10
|
+
- @runtypelabs/react-flow@1.0.41
|
|
11
|
+
|
|
12
|
+
## 0.0.166
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [95e48e6]
|
|
17
|
+
- @runtypelabs/sdk@9.3.1
|
|
18
|
+
- @runtypelabs/react-flow@1.0.40
|
|
19
|
+
|
|
3
20
|
## 0.0.165
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/example/package.json
CHANGED
package/example/src/App.tsx
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
type OnConnect,
|
|
14
14
|
} from '@xyflow/react'
|
|
15
15
|
|
|
16
|
-
// Import node components from the package
|
|
17
16
|
import {
|
|
18
17
|
PromptNode,
|
|
19
18
|
FetchUrlNode,
|
|
@@ -28,16 +27,10 @@ import {
|
|
|
28
27
|
type RuntypeNode,
|
|
29
28
|
} from '@runtypelabs/react-flow'
|
|
30
29
|
|
|
31
|
-
// ============================================================================
|
|
32
|
-
// API Configuration
|
|
33
|
-
// ============================================================================
|
|
34
30
|
|
|
35
31
|
const API_BASE_URL = import.meta.env.VITE_RUNTYPE_API_URL || 'http://localhost:8787/v1'
|
|
36
32
|
const API_KEY = import.meta.env.VITE_RUNTYPE_API_KEY || ''
|
|
37
33
|
|
|
38
|
-
// ============================================================================
|
|
39
|
-
// Flow Browser Types
|
|
40
|
-
// ============================================================================
|
|
41
34
|
|
|
42
35
|
interface Flow {
|
|
43
36
|
id: string
|
|
@@ -58,9 +51,6 @@ interface FlowApiData extends Partial<Flow> {
|
|
|
58
51
|
[key: string]: unknown
|
|
59
52
|
}
|
|
60
53
|
|
|
61
|
-
// ============================================================================
|
|
62
|
-
// Flow Execution Types
|
|
63
|
-
// ============================================================================
|
|
64
54
|
|
|
65
55
|
interface StepProgress {
|
|
66
56
|
id: string
|
|
@@ -103,9 +93,6 @@ interface FlowProgress {
|
|
|
103
93
|
executionTime?: number
|
|
104
94
|
}
|
|
105
95
|
|
|
106
|
-
// ============================================================================
|
|
107
|
-
// Sample Flow Steps
|
|
108
|
-
// ============================================================================
|
|
109
96
|
|
|
110
97
|
const sampleSteps: FlowStep[] = [
|
|
111
98
|
{
|
|
@@ -245,9 +232,6 @@ const sampleSteps: FlowStep[] = [
|
|
|
245
232
|
},
|
|
246
233
|
]
|
|
247
234
|
|
|
248
|
-
// ============================================================================
|
|
249
|
-
// Node Types
|
|
250
|
-
// ============================================================================
|
|
251
235
|
|
|
252
236
|
const nodeTypes = {
|
|
253
237
|
prompt: PromptNode,
|
|
@@ -257,9 +241,6 @@ const nodeTypes = {
|
|
|
257
241
|
'send-email': SendEmailNode,
|
|
258
242
|
}
|
|
259
243
|
|
|
260
|
-
// ============================================================================
|
|
261
|
-
// Dispatch Config Panel Component
|
|
262
|
-
// ============================================================================
|
|
263
244
|
|
|
264
245
|
interface DispatchPanelProps {
|
|
265
246
|
isOpen: boolean
|
|
@@ -271,7 +252,6 @@ interface DispatchPanelProps {
|
|
|
271
252
|
function DispatchPanel({ isOpen, onClose, steps, flowName }: DispatchPanelProps) {
|
|
272
253
|
const [activeTab, setActiveTab] = useState<'dispatch' | 'steps'>('dispatch')
|
|
273
254
|
|
|
274
|
-
// Generate the dispatch config
|
|
275
255
|
const dispatchConfig = useMemo(() => {
|
|
276
256
|
return {
|
|
277
257
|
record: {
|
|
@@ -395,9 +375,6 @@ console.log(response)`}</pre>
|
|
|
395
375
|
)
|
|
396
376
|
}
|
|
397
377
|
|
|
398
|
-
// ============================================================================
|
|
399
|
-
// Execution Panel Component
|
|
400
|
-
// ============================================================================
|
|
401
378
|
|
|
402
379
|
interface ExecutionPanelProps {
|
|
403
380
|
isOpen: boolean
|
|
@@ -565,9 +542,6 @@ function ExecutionPanel({
|
|
|
565
542
|
)
|
|
566
543
|
}
|
|
567
544
|
|
|
568
|
-
// ============================================================================
|
|
569
|
-
// Flow Browser Panel Component
|
|
570
|
-
// ============================================================================
|
|
571
545
|
|
|
572
546
|
interface FlowBrowserPanelProps {
|
|
573
547
|
isOpen: boolean
|
|
@@ -581,7 +555,6 @@ function FlowBrowserPanel({ isOpen, onClose, onLoadFlow }: FlowBrowserPanelProps
|
|
|
581
555
|
const [error, setError] = useState<string | null>(null)
|
|
582
556
|
const [loadingFlowId, setLoadingFlowId] = useState<string | null>(null)
|
|
583
557
|
|
|
584
|
-
// Fetch flows when panel opens
|
|
585
558
|
React.useEffect(() => {
|
|
586
559
|
if (isOpen) {
|
|
587
560
|
fetchFlows()
|
|
@@ -601,7 +574,6 @@ function FlowBrowserPanel({ isOpen, onClose, onLoadFlow }: FlowBrowserPanelProps
|
|
|
601
574
|
throw new Error(`Failed to fetch flows: ${response.status}`)
|
|
602
575
|
}
|
|
603
576
|
const data = await response.json()
|
|
604
|
-
// API returns { data: [...flows], pagination: {...} } format
|
|
605
577
|
setFlows(data.data || data.flows || data || [])
|
|
606
578
|
} catch (err) {
|
|
607
579
|
setError(err instanceof Error ? err.message : 'Failed to fetch flows')
|
|
@@ -614,7 +586,6 @@ function FlowBrowserPanel({ isOpen, onClose, onLoadFlow }: FlowBrowserPanelProps
|
|
|
614
586
|
setLoadingFlowId(flowId)
|
|
615
587
|
setError(null)
|
|
616
588
|
try {
|
|
617
|
-
// Fetch flow details with embedded steps
|
|
618
589
|
const flowResponse = await fetch(`${API_BASE_URL}/flows/${flowId}`, {
|
|
619
590
|
headers: {
|
|
620
591
|
Authorization: `Bearer ${API_KEY}`,
|
|
@@ -625,7 +596,6 @@ function FlowBrowserPanel({ isOpen, onClose, onLoadFlow }: FlowBrowserPanelProps
|
|
|
625
596
|
}
|
|
626
597
|
const flowData = (await flowResponse.json()) as FlowApiData
|
|
627
598
|
|
|
628
|
-
// Use flow steps from the flow response (consolidated endpoint)
|
|
629
599
|
const stepsArray = flowData.flow_steps || flowData.flowSteps || []
|
|
630
600
|
const steps: FlowStep[] = stepsArray.map((step) => ({
|
|
631
601
|
id: step.id,
|
|
@@ -790,9 +760,6 @@ function FlowBrowserPanel({ isOpen, onClose, onLoadFlow }: FlowBrowserPanelProps
|
|
|
790
760
|
)
|
|
791
761
|
}
|
|
792
762
|
|
|
793
|
-
// ============================================================================
|
|
794
|
-
// App Component
|
|
795
|
-
// ============================================================================
|
|
796
763
|
|
|
797
764
|
export default function App() {
|
|
798
765
|
const [steps, setSteps] = useState<FlowStep[]>(sampleSteps)
|
|
@@ -806,16 +773,12 @@ export default function App() {
|
|
|
806
773
|
const textBlockStepIds = useRef(new Map<string, string>())
|
|
807
774
|
const currentStepId = useRef<string | null>(null)
|
|
808
775
|
|
|
809
|
-
// Create stable references for handlers that will update nodes
|
|
810
776
|
const [nodes, setNodes, onNodesChange] = useNodesState<RuntypeNode>([])
|
|
811
777
|
const [edges, setEdges, onEdgesChange] = useEdgesState([])
|
|
812
778
|
const [isInitialized, setIsInitialized] = useState(false)
|
|
813
779
|
|
|
814
|
-
// Handler that updates both steps AND nodes
|
|
815
780
|
const handleStepChangeWithNodes = useCallback(
|
|
816
781
|
(stepId: string, updates: Partial<FlowStep>) => {
|
|
817
|
-
// console.log('[App] handleStepChangeWithNodes:', stepId, updates)
|
|
818
|
-
// Update steps state
|
|
819
782
|
setSteps((prev) =>
|
|
820
783
|
prev.map((step) => {
|
|
821
784
|
if (step.id === stepId) {
|
|
@@ -829,7 +792,6 @@ export default function App() {
|
|
|
829
792
|
})
|
|
830
793
|
)
|
|
831
794
|
|
|
832
|
-
// Update nodes state to reflect the change
|
|
833
795
|
setNodes((nds) =>
|
|
834
796
|
nds.map((node) => {
|
|
835
797
|
if (node.id === stepId) {
|
|
@@ -856,7 +818,6 @@ export default function App() {
|
|
|
856
818
|
[setNodes]
|
|
857
819
|
)
|
|
858
820
|
|
|
859
|
-
// Handler that updates both steps AND nodes for deletion
|
|
860
821
|
const handleStepDeleteWithNodes = useCallback(
|
|
861
822
|
(stepId: string) => {
|
|
862
823
|
setSteps((prev) => prev.filter((step) => step.id !== stepId))
|
|
@@ -866,7 +827,6 @@ export default function App() {
|
|
|
866
827
|
[setNodes, setEdges]
|
|
867
828
|
)
|
|
868
829
|
|
|
869
|
-
// Initialize nodes on first render
|
|
870
830
|
React.useEffect(() => {
|
|
871
831
|
if (!isInitialized) {
|
|
872
832
|
const initialNodes = flowStepsToNodes(steps, {
|
|
@@ -888,19 +848,15 @@ export default function App() {
|
|
|
888
848
|
setEdges,
|
|
889
849
|
])
|
|
890
850
|
|
|
891
|
-
// Derive current steps from nodes
|
|
892
851
|
const currentSteps = useMemo(() => {
|
|
893
852
|
return nodesToFlowSteps(nodes)
|
|
894
853
|
}, [nodes])
|
|
895
854
|
|
|
896
|
-
// Load flow from API
|
|
897
855
|
const handleLoadFlow = useCallback((flow: FlowWithSteps) => {
|
|
898
|
-
// Update steps state
|
|
899
856
|
setSteps(flow.steps)
|
|
900
857
|
setFlowName(flow.name)
|
|
901
858
|
setLoadedFlowId(flow.id)
|
|
902
859
|
|
|
903
|
-
// Reset initialization so nodes get rebuilt
|
|
904
860
|
setIsInitialized(false)
|
|
905
861
|
}, [])
|
|
906
862
|
|
|
@@ -909,7 +865,6 @@ export default function App() {
|
|
|
909
865
|
[setEdges]
|
|
910
866
|
)
|
|
911
867
|
|
|
912
|
-
// Add a new step
|
|
913
868
|
const addStep = useCallback(
|
|
914
869
|
(type: FlowStep['type']) => {
|
|
915
870
|
const newStep = createDefaultStep(type, nodes.length)
|
|
@@ -929,7 +884,6 @@ export default function App() {
|
|
|
929
884
|
|
|
930
885
|
setNodes((nds) => [...nds, newNode])
|
|
931
886
|
|
|
932
|
-
// Add edge from last node
|
|
933
887
|
if (nodes.length > 0) {
|
|
934
888
|
const lastNode = nodes[nodes.length - 1]
|
|
935
889
|
setEdges((eds) => [
|
|
@@ -946,7 +900,6 @@ export default function App() {
|
|
|
946
900
|
[nodes, setNodes, setEdges, handleStepChangeWithNodes, handleStepDeleteWithNodes]
|
|
947
901
|
)
|
|
948
902
|
|
|
949
|
-
// Execute flow via Runtype API
|
|
950
903
|
const executeFlow = useCallback(async () => {
|
|
951
904
|
setIsRunning(true)
|
|
952
905
|
textBlockStepIds.current.clear()
|
|
@@ -962,7 +915,6 @@ export default function App() {
|
|
|
962
915
|
})
|
|
963
916
|
|
|
964
917
|
try {
|
|
965
|
-
// Build dispatch request
|
|
966
918
|
const dispatchRequest = {
|
|
967
919
|
record: {
|
|
968
920
|
name: 'example-record',
|
|
@@ -1020,7 +972,6 @@ export default function App() {
|
|
|
1020
972
|
const chunk = decoder.decode(value, { stream: true })
|
|
1021
973
|
buffer += chunk
|
|
1022
974
|
|
|
1023
|
-
// Parse SSE events
|
|
1024
975
|
const lines = buffer.split('\n')
|
|
1025
976
|
buffer = lines.pop() || '' // Keep incomplete line in buffer
|
|
1026
977
|
|
|
@@ -1039,7 +990,6 @@ export default function App() {
|
|
|
1039
990
|
}
|
|
1040
991
|
}
|
|
1041
992
|
|
|
1042
|
-
// Process remaining buffer
|
|
1043
993
|
if (buffer.startsWith('data: ')) {
|
|
1044
994
|
const eventData = buffer.slice(6)
|
|
1045
995
|
if (eventData && eventData !== '[DONE]') {
|
|
@@ -1066,7 +1016,6 @@ export default function App() {
|
|
|
1066
1016
|
}
|
|
1067
1017
|
}, [currentSteps, flowName])
|
|
1068
1018
|
|
|
1069
|
-
// Handle SSE events from the streaming response
|
|
1070
1019
|
const handleSSEEvent = useCallback((data: ExecutionSSEEvent) => {
|
|
1071
1020
|
switch (data.type) {
|
|
1072
1021
|
case 'execution_start':
|
|
@@ -1335,9 +1284,6 @@ export default function App() {
|
|
|
1335
1284
|
)
|
|
1336
1285
|
}
|
|
1337
1286
|
|
|
1338
|
-
// ============================================================================
|
|
1339
|
-
// Icons
|
|
1340
|
-
// ============================================================================
|
|
1341
1287
|
|
|
1342
1288
|
function CloseIcon() {
|
|
1343
1289
|
return (
|
|
@@ -1498,9 +1444,6 @@ function PendingIcon() {
|
|
|
1498
1444
|
)
|
|
1499
1445
|
}
|
|
1500
1446
|
|
|
1501
|
-
// ============================================================================
|
|
1502
|
-
// Styles
|
|
1503
|
-
// ============================================================================
|
|
1504
1447
|
|
|
1505
1448
|
const headerStyle: React.CSSProperties = {
|
|
1506
1449
|
padding: '16px 24px',
|
|
@@ -1667,7 +1610,6 @@ const infoStyle: React.CSSProperties = {
|
|
|
1667
1610
|
color: '#6b7280',
|
|
1668
1611
|
}
|
|
1669
1612
|
|
|
1670
|
-
// Panel Styles
|
|
1671
1613
|
const panelOverlayStyle: React.CSSProperties = {
|
|
1672
1614
|
position: 'fixed',
|
|
1673
1615
|
top: 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runtypelabs/react-flow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.41",
|
|
4
4
|
"description": "React Flow adapter for building visual flow editors with Runtype",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"*.css"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@runtypelabs/sdk": "9.3.
|
|
19
|
+
"@runtypelabs/sdk": "9.3.2"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@xyflow/react": "^12.0.0",
|
|
@@ -26,9 +26,6 @@ import { ConditionalNode } from './nodes/ConditionalNode'
|
|
|
26
26
|
import { SendEmailNode } from './nodes/SendEmailNode'
|
|
27
27
|
import { BaseNode, BrainIcon, NODE_HEADER_COLORS } from './nodes/BaseNode'
|
|
28
28
|
|
|
29
|
-
// ============================================================================
|
|
30
|
-
// Styles
|
|
31
|
-
// ============================================================================
|
|
32
29
|
|
|
33
30
|
const styles = {
|
|
34
31
|
container: {
|
|
@@ -145,9 +142,6 @@ const styles = {
|
|
|
145
142
|
},
|
|
146
143
|
}
|
|
147
144
|
|
|
148
|
-
// ============================================================================
|
|
149
|
-
// Node Types Configuration
|
|
150
|
-
// ============================================================================
|
|
151
145
|
|
|
152
146
|
const nodeTypes: NodeTypes = {
|
|
153
147
|
prompt: PromptNode,
|
|
@@ -155,11 +149,9 @@ const nodeTypes: NodeTypes = {
|
|
|
155
149
|
'transform-data': CodeNode,
|
|
156
150
|
conditional: ConditionalNode,
|
|
157
151
|
'send-email': SendEmailNode,
|
|
158
|
-
// Default node for unsupported types
|
|
159
152
|
default: DefaultNode,
|
|
160
153
|
}
|
|
161
154
|
|
|
162
|
-
// Default node for unsupported step types
|
|
163
155
|
function DefaultNode(props: {
|
|
164
156
|
data: { step: FlowStep; label: string }
|
|
165
157
|
selected?: boolean
|
|
@@ -183,9 +175,6 @@ function DefaultNode(props: {
|
|
|
183
175
|
)
|
|
184
176
|
}
|
|
185
177
|
|
|
186
|
-
// ============================================================================
|
|
187
|
-
// Step Type Options
|
|
188
|
-
// ============================================================================
|
|
189
178
|
|
|
190
179
|
const STEP_TYPE_OPTIONS: Array<{
|
|
191
180
|
type: SupportedNodeType
|
|
@@ -225,9 +214,6 @@ const STEP_TYPE_OPTIONS: Array<{
|
|
|
225
214
|
},
|
|
226
215
|
]
|
|
227
216
|
|
|
228
|
-
// ============================================================================
|
|
229
|
-
// Main Editor Component
|
|
230
|
-
// ============================================================================
|
|
231
217
|
|
|
232
218
|
export function RuntypeFlowEditor({
|
|
233
219
|
client,
|
|
@@ -245,7 +231,6 @@ export function RuntypeFlowEditor({
|
|
|
245
231
|
const [showAddMenu, setShowAddMenu] = useState(false)
|
|
246
232
|
const [, setSelectedNode] = useState<RuntypeNode | null>(null)
|
|
247
233
|
|
|
248
|
-
// Initialize flow hook
|
|
249
234
|
const {
|
|
250
235
|
nodes,
|
|
251
236
|
edges,
|
|
@@ -270,10 +255,8 @@ export function RuntypeFlowEditor({
|
|
|
270
255
|
autoLayoutOnLoad: true,
|
|
271
256
|
})
|
|
272
257
|
|
|
273
|
-
// Validation
|
|
274
258
|
const { result: validationResult } = useFlowValidation({ nodes })
|
|
275
259
|
|
|
276
|
-
// Handlers
|
|
277
260
|
const handleSave = useCallback(async () => {
|
|
278
261
|
try {
|
|
279
262
|
const savedFlow = await saveFlow()
|
|
@@ -304,7 +287,6 @@ export function RuntypeFlowEditor({
|
|
|
304
287
|
onStepSelect?.(null)
|
|
305
288
|
}, [onStepSelect])
|
|
306
289
|
|
|
307
|
-
// Minimap node color
|
|
308
290
|
const minimapNodeColor = useCallback((node: RuntypeNode) => {
|
|
309
291
|
return NODE_HEADER_COLORS[node.data.step.type] || NODE_HEADER_COLORS.default
|
|
310
292
|
}, [])
|
|
@@ -464,9 +446,6 @@ export function RuntypeFlowEditor({
|
|
|
464
446
|
)
|
|
465
447
|
}
|
|
466
448
|
|
|
467
|
-
// ============================================================================
|
|
468
|
-
// Icon Components
|
|
469
|
-
// ============================================================================
|
|
470
449
|
|
|
471
450
|
function PlusIcon() {
|
|
472
451
|
return (
|
|
@@ -2,9 +2,6 @@ import React, { memo } from 'react'
|
|
|
2
2
|
import { Handle, Position } from '@xyflow/react'
|
|
3
3
|
import type { RuntypeNodeData } from '../../types'
|
|
4
4
|
|
|
5
|
-
// ============================================================================
|
|
6
|
-
// Types
|
|
7
|
-
// ============================================================================
|
|
8
5
|
|
|
9
6
|
export interface BaseNodeProps {
|
|
10
7
|
/** Node data containing the step */
|
|
@@ -35,9 +32,6 @@ export interface BaseNodeProps {
|
|
|
35
32
|
children: React.ReactNode
|
|
36
33
|
}
|
|
37
34
|
|
|
38
|
-
// ============================================================================
|
|
39
|
-
// Styles
|
|
40
|
-
// ============================================================================
|
|
41
35
|
|
|
42
36
|
const styles = {
|
|
43
37
|
container: (selected: boolean) => ({
|
|
@@ -129,9 +123,6 @@ const styles = {
|
|
|
129
123
|
}),
|
|
130
124
|
}
|
|
131
125
|
|
|
132
|
-
// ============================================================================
|
|
133
|
-
// Header Color Presets
|
|
134
|
-
// ============================================================================
|
|
135
126
|
|
|
136
127
|
export const NODE_HEADER_COLORS: Record<string, string> = {
|
|
137
128
|
prompt: '#f3e8ff', // Purple tint
|
|
@@ -142,9 +133,6 @@ export const NODE_HEADER_COLORS: Record<string, string> = {
|
|
|
142
133
|
default: '#f3f4f6', // Gray tint
|
|
143
134
|
}
|
|
144
135
|
|
|
145
|
-
// ============================================================================
|
|
146
|
-
// Base Node Component
|
|
147
|
-
// ============================================================================
|
|
148
136
|
|
|
149
137
|
export const BaseNode = memo(function BaseNode({
|
|
150
138
|
data,
|
|
@@ -168,7 +156,7 @@ export const BaseNode = memo(function BaseNode({
|
|
|
168
156
|
|
|
169
157
|
return (
|
|
170
158
|
<div style={styles.container(selected)}>
|
|
171
|
-
{
|
|
159
|
+
{}
|
|
172
160
|
{showTargetHandle && (
|
|
173
161
|
<Handle
|
|
174
162
|
type="target"
|
|
@@ -210,12 +198,12 @@ export const BaseNode = memo(function BaseNode({
|
|
|
210
198
|
</div>
|
|
211
199
|
</div>
|
|
212
200
|
|
|
213
|
-
{
|
|
201
|
+
{}
|
|
214
202
|
<div style={styles.body} className="nodrag">
|
|
215
203
|
{children}
|
|
216
204
|
</div>
|
|
217
205
|
|
|
218
|
-
{
|
|
206
|
+
{}
|
|
219
207
|
{showSourceHandle && (
|
|
220
208
|
<Handle
|
|
221
209
|
type="source"
|
|
@@ -225,7 +213,7 @@ export const BaseNode = memo(function BaseNode({
|
|
|
225
213
|
/>
|
|
226
214
|
)}
|
|
227
215
|
|
|
228
|
-
{
|
|
216
|
+
{}
|
|
229
217
|
{additionalSourceHandles?.map((handle) => (
|
|
230
218
|
<Handle
|
|
231
219
|
key={handle.id}
|
|
@@ -243,9 +231,6 @@ export const BaseNode = memo(function BaseNode({
|
|
|
243
231
|
)
|
|
244
232
|
})
|
|
245
233
|
|
|
246
|
-
// ============================================================================
|
|
247
|
-
// Icon Components
|
|
248
|
-
// ============================================================================
|
|
249
234
|
|
|
250
235
|
const DeleteIcon = () => (
|
|
251
236
|
<svg
|
|
@@ -264,7 +249,6 @@ const DeleteIcon = () => (
|
|
|
264
249
|
</svg>
|
|
265
250
|
)
|
|
266
251
|
|
|
267
|
-
// Export common icons for use in step nodes
|
|
268
252
|
export const BrainIcon = () => (
|
|
269
253
|
<svg
|
|
270
254
|
width="16"
|
|
@@ -3,9 +3,6 @@ import type { NodeProps } from '@xyflow/react'
|
|
|
3
3
|
import { BaseNode, CodeIcon, NODE_HEADER_COLORS } from './BaseNode'
|
|
4
4
|
import type { RuntypeNodeData, TransformDataStepConfig, FlowStep } from '../../types'
|
|
5
5
|
|
|
6
|
-
// ============================================================================
|
|
7
|
-
// Styles
|
|
8
|
-
// ============================================================================
|
|
9
6
|
|
|
10
7
|
const styles = {
|
|
11
8
|
field: {
|
|
@@ -100,9 +97,6 @@ const styles = {
|
|
|
100
97
|
},
|
|
101
98
|
}
|
|
102
99
|
|
|
103
|
-
// ============================================================================
|
|
104
|
-
// Code Node Component
|
|
105
|
-
// ============================================================================
|
|
106
100
|
|
|
107
101
|
export const CodeNode = memo(function CodeNode(props: NodeProps) {
|
|
108
102
|
const { data, selected, id } = props as NodeProps & { data: RuntypeNodeData }
|
|
@@ -4,9 +4,6 @@ import { Position } from '@xyflow/react'
|
|
|
4
4
|
import { BaseNode, GitBranchIcon, NODE_HEADER_COLORS } from './BaseNode'
|
|
5
5
|
import type { RuntypeNodeData, ConditionalStepConfig, FlowStep } from '../../types'
|
|
6
6
|
|
|
7
|
-
// ============================================================================
|
|
8
|
-
// Styles
|
|
9
|
-
// ============================================================================
|
|
10
7
|
|
|
11
8
|
const styles = {
|
|
12
9
|
field: {
|
|
@@ -83,9 +80,6 @@ const styles = {
|
|
|
83
80
|
},
|
|
84
81
|
}
|
|
85
82
|
|
|
86
|
-
// ============================================================================
|
|
87
|
-
// Conditional Node Component
|
|
88
|
-
// ============================================================================
|
|
89
83
|
|
|
90
84
|
export const ConditionalNode = memo(function ConditionalNode(props: NodeProps) {
|
|
91
85
|
const { data, selected, id } = props as NodeProps & { data: RuntypeNodeData }
|
|
@@ -227,9 +221,6 @@ export const ConditionalNode = memo(function ConditionalNode(props: NodeProps) {
|
|
|
227
221
|
)
|
|
228
222
|
})
|
|
229
223
|
|
|
230
|
-
// ============================================================================
|
|
231
|
-
// Icon Components
|
|
232
|
-
// ============================================================================
|
|
233
224
|
|
|
234
225
|
const TrueIcon = () => (
|
|
235
226
|
<svg
|
|
@@ -3,9 +3,6 @@ import type { NodeProps } from '@xyflow/react'
|
|
|
3
3
|
import { BaseNode, GlobeIcon, NODE_HEADER_COLORS } from './BaseNode'
|
|
4
4
|
import type { RuntypeNodeData, FetchUrlStepConfig, FlowStep } from '../../types'
|
|
5
5
|
|
|
6
|
-
// ============================================================================
|
|
7
|
-
// Styles
|
|
8
|
-
// ============================================================================
|
|
9
6
|
|
|
10
7
|
const styles = {
|
|
11
8
|
field: {
|
|
@@ -93,9 +90,6 @@ const styles = {
|
|
|
93
90
|
},
|
|
94
91
|
}
|
|
95
92
|
|
|
96
|
-
// ============================================================================
|
|
97
|
-
// Fetch URL Node Component
|
|
98
|
-
// ============================================================================
|
|
99
93
|
|
|
100
94
|
export const FetchUrlNode = memo(function FetchUrlNode(props: NodeProps) {
|
|
101
95
|
const { data, selected, id } = props as NodeProps & { data: RuntypeNodeData }
|
|
@@ -131,7 +125,6 @@ export const FetchUrlNode = memo(function FetchUrlNode(props: NodeProps) {
|
|
|
131
125
|
|
|
132
126
|
const handleNameChange = useCallback(
|
|
133
127
|
(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
134
|
-
// console.log('[FetchUrlNode] Name change:', e.target.value)
|
|
135
128
|
onChange?.(id, { name: e.target.value })
|
|
136
129
|
},
|
|
137
130
|
[id, onChange]
|
|
@@ -156,10 +149,8 @@ export const FetchUrlNode = memo(function FetchUrlNode(props: NodeProps) {
|
|
|
156
149
|
onChange={handleNameChange}
|
|
157
150
|
placeholder="Enter step name"
|
|
158
151
|
onKeyDown={(e) => {
|
|
159
|
-
// console.log('[FetchUrlNode] KeyDown:', e.key)
|
|
160
152
|
e.stopPropagation()
|
|
161
153
|
}}
|
|
162
|
-
// onInput={(e) => console.log('[FetchUrlNode] Input event:', (e.target as HTMLInputElement).value)}
|
|
163
154
|
/>
|
|
164
155
|
</div>
|
|
165
156
|
|
|
@@ -3,9 +3,6 @@ import type { NodeProps } from '@xyflow/react'
|
|
|
3
3
|
import { BaseNode, BrainIcon, NODE_HEADER_COLORS } from './BaseNode'
|
|
4
4
|
import type { RuntypeNodeData, PromptStepConfig, FlowStep } from '../../types'
|
|
5
5
|
|
|
6
|
-
// ============================================================================
|
|
7
|
-
// Styles
|
|
8
|
-
// ============================================================================
|
|
9
6
|
|
|
10
7
|
const styles = {
|
|
11
8
|
field: {
|
|
@@ -86,9 +83,6 @@ const styles = {
|
|
|
86
83
|
},
|
|
87
84
|
}
|
|
88
85
|
|
|
89
|
-
// ============================================================================
|
|
90
|
-
// Prompt Node Component
|
|
91
|
-
// ============================================================================
|
|
92
86
|
|
|
93
87
|
export const PromptNode = memo(function PromptNode(props: NodeProps) {
|
|
94
88
|
const { data, selected, id } = props as NodeProps & { data: RuntypeNodeData }
|
|
@@ -3,9 +3,6 @@ import type { NodeProps } from '@xyflow/react'
|
|
|
3
3
|
import { BaseNode, MailIcon, NODE_HEADER_COLORS } from './BaseNode'
|
|
4
4
|
import type { RuntypeNodeData, SendEmailStepConfig, FlowStep } from '../../types'
|
|
5
5
|
|
|
6
|
-
// ============================================================================
|
|
7
|
-
// Styles
|
|
8
|
-
// ============================================================================
|
|
9
6
|
|
|
10
7
|
const styles = {
|
|
11
8
|
field: {
|
|
@@ -93,9 +90,6 @@ const styles = {
|
|
|
93
90
|
},
|
|
94
91
|
}
|
|
95
92
|
|
|
96
|
-
// ============================================================================
|
|
97
|
-
// Send Email Node Component
|
|
98
|
-
// ============================================================================
|
|
99
93
|
|
|
100
94
|
export const SendEmailNode = memo(function SendEmailNode(props: NodeProps) {
|
|
101
95
|
const { data, selected, id } = props as NodeProps & { data: RuntypeNodeData }
|
|
@@ -123,7 +117,6 @@ export const SendEmailNode = memo(function SendEmailNode(props: NodeProps) {
|
|
|
123
117
|
[id, onChange]
|
|
124
118
|
)
|
|
125
119
|
|
|
126
|
-
// Check for template variables in fields
|
|
127
120
|
const hasVariables = (value: string) => /\{\{[\w._]+\}\}/.test(value)
|
|
128
121
|
|
|
129
122
|
return (
|