Spaces:
Running
Running
File size: 864 Bytes
01f62f3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
<script lang="ts">
import { writable } from 'svelte/store';
import {
SvelteFlow,
Controls,
Background,
MiniMap,
Position,
type Node,
type Edge,
} from '@xyflow/svelte';
import '@xyflow/svelte/dist/style.css';
const nodes = writable<Node[]>([
{
id: '1',
data: { label: 'Hello' },
position: { x: 0, y: 0 },
sourcePosition: Position.Left,
targetPosition: Position.Right,
},
{
id: '2',
data: { label: 'World' },
position: { x: 150, y: 150 },
},
]);
const edges = writable<Edge[]>([
{
id: '1-2',
source: '1',
target: '2',
},
]);
</script>
<div style:height="100vh">
<SvelteFlow {nodes} {edges} fitView>
<Background variant="dots" gap="6" size="1" />
<Controls />
<Background />
<MiniMap />
</SvelteFlow>
</div>
|