import { readable, writable } from 'svelte/store'; import { infiniteExtent, SelectionMode, ConnectionMode, ConnectionLineType, type SelectionRect, type Transform, type SnapGrid, type MarkerProps, type PanZoomInstance, type CoordinateExtent, type IsValidConnection } from '@xyflow/system'; import DefaultNode from '$lib/components/nodes/DefaultNode.svelte'; import InputNode from '$lib/components/nodes/InputNode.svelte'; import OutputNode from '$lib/components/nodes/OutputNode.svelte'; import BezierEdge from '$lib/components/edges/BezierEdge.svelte'; import StraightEdge from '$lib/components/edges/StraightEdge.svelte'; import SmoothStepEdge from '$lib/components/edges/SmoothStepEdge.svelte'; import StepEdge from '$lib/components/edges/StepEdge.svelte'; import type { ConnectionData, NodeTypes, EdgeTypes, EdgeLayouted, Edge, Node } from '$lib/types'; export const initConnectionData = { connectionStartHandle: null, connectionEndHandle: null, connectionPosition: null, connectionStatus: null }; export const initialNodeTypes = { input: InputNode, output: OutputNode, default: DefaultNode }; export const initialEdgeTypes = { straight: StraightEdge, smoothstep: SmoothStepEdge, default: BezierEdge, step: StepEdge }; export const initialStoreState = { flowId: writable(null), nodes: writable([]), edges: writable([]), edgesLayouted: readable([]), height: writable(500), width: writable(500), minZoom: writable(0.5), maxZoom: writable(2), nodeExtent: writable(infiniteExtent), translateExtent: writable(infiniteExtent), autoPanOnNodeDrag: writable(true), fitViewOnInit: writable(false), fitViewOnInitDone: writable(false), panZoom: writable(null), snapGrid: writable(null), dragging: writable(false), selectionRect: writable(null), selectionKeyPressed: writable(false), multiselectionKeyPressed: writable(false), deleteKeyPressed: writable(false), selectionRectMode: writable(null), selectionMode: writable(SelectionMode.Partial), nodeTypes: writable(initialNodeTypes), edgeTypes: writable(initialEdgeTypes), transform: writable([0, 0, 1]), connectionMode: writable(ConnectionMode.Strict), domNode: writable(null), connectionPath: readable(null), connection: writable(initConnectionData), connectionRadius: writable(25), connectionLineType: writable(ConnectionLineType.Bezier), isValidConnection: writable(() => true), nodesDraggable: writable(true), nodesConnectable: writable(true), elementsSelectable: writable(true), selectNodesOnDrag: writable(true), markers: readable([]), defaultMarkerColor: writable('#b1b1b7'), lib: readable('svelte') };