import { I as VisualGraph, z as VisualGraphFormatConverter } from "../../types-BAEQTwK_.mjs"; import { EdgeBase, NodeBase } from "@xyflow/system"; //#region src/formats/xyflow/index.d.ts /** xyflow Node — re-exported from `@xyflow/system`. */ type XYFlowNode = Record> = NodeBase; /** * xyflow Edge — `EdgeBase` from `@xyflow/system` plus the top-level `label` * that React Flow / Svelte Flow actually render (it's a renderer prop, so * `EdgeBase` itself doesn't declare it). */ type XYFlowEdge = Record> = EdgeBase & { label?: string; }; interface XYFlow = Record, TEdgeData extends Record = Record> { nodes: XYFlowNode[]; edges: XYFlowEdge[]; data?: Record; } /** * Converts a visual graph to xyflow (React Flow / Svelte Flow) format. * * @example * ```ts * import { createVisualGraph } from '@statelyai/graph'; * import { toXYFlow } from '@statelyai/graph/xyflow'; * * const graph = createVisualGraph({ * nodes: [ * { id: 'a', x: 0, y: 0, width: 100, height: 50 }, * { id: 'b', x: 200, y: 100, width: 100, height: 50 }, * ], * edges: [{ id: 'e0', sourceId: 'a', targetId: 'b' }], * }); * * const flow = toXYFlow(graph); * // { nodes: [...], edges: [...] } * ``` */ declare function toXYFlow(graph: VisualGraph): XYFlow; /** * Parses an xyflow (React Flow / Svelte Flow) object into a visual graph. * * @example * ```ts * import { fromXYFlow } from '@statelyai/graph/xyflow'; * * const graph = fromXYFlow({ * nodes: [ * { id: 'a', position: { x: 0, y: 0 }, data: {} }, * { id: 'b', position: { x: 200, y: 100 }, data: {} }, * ], * edges: [{ id: 'e0', source: 'a', target: 'b' }], * }); * ``` */ declare function fromXYFlow(flow: XYFlow): VisualGraph; /** * Bidirectional converter for xyflow (React Flow / Svelte Flow) format. * * @example * ```ts * import { createVisualGraph } from '@statelyai/graph'; * import { xyflowConverter } from '@statelyai/graph/xyflow'; * * const graph = createVisualGraph({ * nodes: [ * { id: 'a', x: 0, y: 0, width: 100, height: 50 }, * { id: 'b', x: 200, y: 100, width: 100, height: 50 }, * ], * edges: [{ id: 'e0', sourceId: 'a', targetId: 'b' }], * }); * * const flow = xyflowConverter.to(graph); * const roundTripped = xyflowConverter.from(flow); * ``` */ declare const xyflowConverter: VisualGraphFormatConverter; //#endregion export { XYFlow, XYFlowEdge, XYFlowNode, fromXYFlow, toXYFlow, xyflowConverter };