diff options
| author | Sam Nystrom <sam@samnystrom.dev> | 2024-03-10 16:23:07 -0400 |
|---|---|---|
| committer | Sam Nystrom <sam@samnystrom.dev> | 2024-03-10 16:23:07 -0400 |
| commit | 367fe51e7e1c55e39299e2e667ca4f399a474019 (patch) | |
| tree | 7529a1ba2f758a54e2bca845af36536e637545ed | |
| parent | b95a2af981c903489631d7a9a3aa04cab8b18c5a (diff) | |
cleanup
| -rw-r--r-- | .editorconfig | 9 | ||||
| -rw-r--r-- | src/NodeEditor.tsx | 6 | ||||
| -rw-r--r-- | src/Toolbar.tsx | 4 | ||||
| -rw-r--r-- | src/index.tsx | 2 |
4 files changed, 15 insertions, 6 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..90817de --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +indent_style = tab +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/src/NodeEditor.tsx b/src/NodeEditor.tsx index 17e7c27..e4b584d 100644 --- a/src/NodeEditor.tsx +++ b/src/NodeEditor.tsx @@ -63,7 +63,7 @@ export const NodeEditor = () => { const instantiateNode = useMemo(nodeFactory, []); const svgRef = useRef(null); - const nodes = useSignal([ + const initialNodes = useMemo(() => [ instantiateNode(100, 100, nodeRegistry['Linspace']), instantiateNode(350, 200, nodeRegistry['Math']), instantiateNode(350, 50, nodeRegistry['Intersperse']), @@ -72,6 +72,8 @@ export const NodeEditor = () => { instantiateNode(900, 250, nodeRegistry['Plot']), ]); + const nodes = useSignal(initialNodes); + const currentLink = useSignal<null | Omit<LinkData, 'to'>>(null); const links = useSignal<LinkData[]>([]); const allLinks = useComputed(() => (links.value as LinkProps[]).concat(currentLink.value as LinkProps ?? [])); @@ -261,4 +263,4 @@ export const NodeEditor = () => { </main> </> ); -};
\ No newline at end of file +}; diff --git a/src/Toolbar.tsx b/src/Toolbar.tsx index 62c79fe..dded98d 100644 --- a/src/Toolbar.tsx +++ b/src/Toolbar.tsx @@ -23,8 +23,8 @@ export const Toolbar = ({ nodes, onNodeAdded = _ => {} }: ToolbarProps) => { <button popoverTarget={id}>Add</button> </li> </menu> - <h1>My Project</h1> + <h1>Sample Project</h1> <div></div> </div> ); -};
\ No newline at end of file +}; diff --git a/src/index.tsx b/src/index.tsx index ea83e21..bff0b70 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,10 +1,8 @@ import { render } from 'preact'; -import { useErrorBoundary } from 'preact/hooks'; import { NodeEditor } from './NodeEditor.tsx'; import './index.css'; export const App = () => { - const [error] = useErrorBoundary(error => alert(error)); return ( <NodeEditor /> ); |
