Flow.svelte 728 B

1234567891011121314151617181920212223242526272829303132
  1. <script>
  2. import { theme } from '$lib/stores';
  3. import { Background, Controls, SvelteFlow, BackgroundVariant } from '@xyflow/svelte';
  4. export let nodes;
  5. export let nodeTypes;
  6. export let edges;
  7. </script>
  8. <SvelteFlow
  9. {nodes}
  10. {nodeTypes}
  11. {edges}
  12. fitView
  13. minZoom={0.001}
  14. colorMode={$theme.includes('dark')
  15. ? 'dark'
  16. : $theme === 'system'
  17. ? window.matchMedia('(prefers-color-scheme: dark)').matches
  18. ? 'dark'
  19. : 'light'
  20. : 'light'}
  21. nodesConnectable={false}
  22. nodesDraggable={false}
  23. on:nodeclick={(event) => console.log('on node click', event.detail.node)}
  24. oninit={() => {
  25. console.log('Flow initialized');
  26. }}
  27. >
  28. <Controls showLock={false} />
  29. <Background variant={BackgroundVariant.Dots} />
  30. </SvelteFlow>