chore(svelte): use prettier

This commit is contained in:
moklick
2023-06-06 15:46:19 +02:00
parent c4e98dd420
commit 84603bd966
34 changed files with 335 additions and 330 deletions
@@ -6,8 +6,10 @@
Background,
BackgroundVariant,
MiniMap,
Position,
type Node,
type NodeTypes,
Position
type Edge
} from '../../lib/index';
import { CustomNode } from './CustomNode';
@@ -15,8 +17,8 @@
colorNode: CustomNode
};
const bgColor = writable('#1A192B')
const bgColor = writable('#1A192B');
const onChange: ChangeEventHandler<HTMLInputElement> = (event) => {
nodes.update((nds) =>
nds.map((node) => {
@@ -32,75 +34,69 @@
...node,
data: {
...node.data,
color,
},
color
}
};
})
);
};
const nodes = writable([
{
id: '1',
type: 'input',
data: { label: 'An input node' },
position: { x: 0, y: 50 },
sourcePosition: Position.Right,
},
{
id: '2',
type: 'colorNode',
data: { onChange: onChange, color: $bgColor },
style: 'border: 1px solid #777; padding: 10px',
position: { x: 250, y: 50 },
},
{
id: '3',
type: 'output',
data: { label: 'Output A' },
position: { x: 650, y: 25 },
targetPosition: Position.Left,
},
{
id: '4',
type: 'output',
data: { label: 'Output B' },
position: { x: 650, y: 120 },
targetPosition: Position.Left,
},
const nodes = writable<Node[]>([
{
id: '1',
type: 'input',
data: { label: 'An input node' },
position: { x: 0, y: 50 },
sourcePosition: Position.Right
},
{
id: '2',
type: 'colorNode',
data: { onChange: onChange, color: $bgColor },
style: 'border: 1px solid #777; padding: 10px',
position: { x: 250, y: 50 }
},
{
id: '3',
type: 'output',
data: { label: 'Output A' },
position: { x: 650, y: 25 },
targetPosition: Position.Left
},
{
id: '4',
type: 'output',
data: { label: 'Output B' },
position: { x: 650, y: 120 },
targetPosition: Position.Left
}
]);
const edges = writable([
const edges = writable<Edge[]>([
{
id: 'e1-2',
source: '1',
target: '2',
animated: true,
animated: true
},
{
id: 'e2a-3',
source: '2',
sourceHandle: 'a',
target: '3',
animated: true,
animated: true
},
{
id: 'e2b-4',
source: '2',
sourceHandle: 'b',
target: '4',
animated: true,
},
animated: true
}
]);
</script>
<SvelteFlow
{nodes}
{edges}
{nodeTypes}
style="--bgcolor: {$bgColor}"
fitView
>
<SvelteFlow {nodes} {edges} {nodeTypes} style="--bgcolor: {$bgColor}" fitView>
<Controls />
<Background variant={BackgroundVariant.Dots} />
<MiniMap />