12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <script>
- import { createEventDispatcher } from 'svelte';
- const dispatch = createEventDispatcher();
- import { theme } from '$lib/stores';
- import {
- Background,
- Controls,
- SvelteFlow,
- BackgroundVariant,
- ControlButton
- } from '@xyflow/svelte';
- import BarsArrowUp from '$lib/components/icons/BarsArrowUp.svelte';
- import Bars3BottomLeft from '$lib/components/icons/Bars3BottomLeft.svelte';
- export let nodes;
- export let nodeTypes;
- export let edges;
- export let setLayoutDirection;
- </script>
- <SvelteFlow
- {nodes}
- {nodeTypes}
- {edges}
- fitView
- minZoom={0.001}
- colorMode={$theme.includes('dark')
- ? 'dark'
- : $theme === 'system'
- ? window.matchMedia('(prefers-color-scheme: dark)').matches
- ? 'dark'
- : 'light'
- : 'light'}
- nodesConnectable={false}
- nodesDraggable={false}
- on:nodeclick={(e) => dispatch('nodeclick', e.detail)}
- oninit={() => {
- console.log('Flow initialized');
- }}
- >
- <Controls showLock={false}>
- <ControlButton on:click={() => setLayoutDirection('vertical')} title="Vertical Layout">
- <BarsArrowUp class="size-4" />
- </ControlButton>
- <ControlButton on:click={() => setLayoutDirection('horizontal')} title="Horizontal Layout">
- <Bars3BottomLeft class="size-4" />
- </ControlButton>
- </Controls>
- <Background variant={BackgroundVariant.Dots} />
- </SvelteFlow>
|