-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #235 from bhouston/move-registry-out-of-flow
registry is a flow prop now.
- Loading branch information
Showing
11 changed files
with
223 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import Branch from '../../../../graphs/core/flow/Branch.json'; | ||
import HelloWorld from '../../../../graphs/core/HelloWorld.json'; | ||
import Polynomial from '../../../../graphs/core/logic/Polynomial.json'; | ||
import Delay from '../../../../graphs/core/time/Delay.json'; | ||
import SetGet from '../../../../graphs/core/variables/SetGet.json'; | ||
import rawGraph from '../graph.json'; | ||
import { GraphJSON } from '@behave-graph/core'; | ||
import { Examples, Flow } from '@behave-graph/flow'; | ||
import { useRegistry } from '../hooks/useRegistry.js'; | ||
|
||
const graph = rawGraph as unknown as GraphJSON; | ||
|
||
// TODO remove when json types fixed in behave-graph | ||
const examples: Examples = { | ||
branch: Branch as unknown as GraphJSON, | ||
delay: Delay as unknown as GraphJSON, | ||
helloWorld: HelloWorld as unknown as GraphJSON, | ||
polynomial: Polynomial as unknown as GraphJSON, | ||
setGet: SetGet as unknown as GraphJSON | ||
} as Record<string, GraphJSON>; | ||
|
||
const MyFlow: React.FC = () => { | ||
const registry = useRegistry(); | ||
return <Flow registry={registry} initialGraph={graph} examples={examples} />; | ||
}; | ||
|
||
export default MyFlow; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,16 @@ | ||
import 'reactflow/dist/style.css'; | ||
import './styles.css'; | ||
|
||
import { GraphJSON } from '@behave-graph/core'; | ||
import { Examples, Flow } from '@behave-graph/flow'; | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
|
||
import Branch from '../../../graphs/core/flow/Branch.json'; | ||
import HelloWorld from '../../../graphs/core/HelloWorld.json'; | ||
import Polynomial from '../../../graphs/core/logic/Polynomial.json'; | ||
import Delay from '../../../graphs/core/time/Delay.json'; | ||
import SetGet from '../../../graphs/core/variables/SetGet.json'; | ||
import rawGraph from './graph.json'; | ||
|
||
const graph = rawGraph as unknown as GraphJSON; | ||
import MyFlow from './components/MyFlow.js'; | ||
|
||
const root = ReactDOM.createRoot( | ||
document.getElementById('root') as HTMLElement | ||
); | ||
|
||
// TODO remove when json types fixed in behave-graph | ||
const examples: Examples = { | ||
branch: Branch as unknown as GraphJSON, | ||
delay: Delay as unknown as GraphJSON, | ||
helloWorld: HelloWorld as unknown as GraphJSON, | ||
polynomial: Polynomial as unknown as GraphJSON, | ||
setGet: SetGet as unknown as GraphJSON | ||
} as Record<string, GraphJSON>; | ||
|
||
root.render( | ||
<React.StrictMode> | ||
<Flow initialGraph={graph} examples={examples} /> | ||
<MyFlow /> | ||
</React.StrictMode> | ||
); |
Oops, something went wrong.