From 367fe51e7e1c55e39299e2e667ca4f399a474019 Mon Sep 17 00:00:00 2001 From: Sam Nystrom Date: Sun, 10 Mar 2024 16:23:07 -0400 Subject: cleanup --- .editorconfig | 9 +++++++++ src/NodeEditor.tsx | 6 ++++-- src/Toolbar.tsx | 4 ++-- src/index.tsx | 2 -- 4 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 .editorconfig 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); const links = useSignal([]); const allLinks = useComputed(() => (links.value as LinkProps[]).concat(currentLink.value as LinkProps ?? [])); @@ -261,4 +263,4 @@ export const NodeEditor = () => { ); -}; \ 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) => { -

My Project

+

Sample Project

); -}; \ 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 ( ); -- cgit v1.2.3