import { xy } from '@synnaxlabs/x'; import { ReactFlowProps } from '@xyflow/react'; import { ClipboardEvent as ReactClipboardEvent, ComponentPropsWithRef, FC, PropsWithChildren, ReactElement } from 'react'; import { z } from 'zod'; import { Aether } from '../../aether'; import { RenderProp } from '../../component/renderProp'; import { Viewport as BaseViewport } from '../../viewport'; import { diagram } from './aether'; import { Edge, EdgeChange, Node, NodeChange, Viewport } from './aether/types'; export interface NodeProps { nodeKey: string; position: xy.XY; selected: boolean; draggable: boolean; } export interface RendererConfig { /** Renders each node by key. */ node: RenderProp; /** Renders each edge; falls back to React Flow's default edge when omitted. */ edge?: RenderProp; /** Renders the line shown while dragging a new connection. */ connectionLine?: RenderProp; /** Wraps the diagram inside the React Flow store context, above all renderers. */ Provider?: FC; } export type ClipboardHandler = (this: void, e: ReactClipboardEvent, cursor: xy.XY) => void; export interface DiagramProps extends Omit, "onError" | "onCopy" | "onCut" | "onPaste">, Pick, "visible" | "autoRenderInterval">, Aether.ComponentProps, Pick { edges: Edge[]; nodes: Node[]; onNodesChange: (changes: NodeChange[]) => void; onEdgesChange: (changes: EdgeChange[]) => void; selected?: string[]; onSelectionChange?: (selected: string[]) => void; editable: boolean; onEditableChange: (v: boolean) => void; onViewportChange: (vp: Viewport) => void; viewport: Viewport; fitViewOnResize: boolean; setFitViewOnResize: (v: boolean) => void; viewportMode: BaseViewport.Mode; onViewportModeChange: (v: BaseViewport.Mode) => void; triggers?: BaseViewport.UseTriggers; dragHandleSelector?: string; /** * Called when a copy event fires on the diagram. The second argument is the * cursor position in diagram space at the moment of the copy, derived from * the most recent mousemove over the diagram. */ onCopy?: ClipboardHandler; /** * Called when a cut event fires on the diagram. The second argument is the * cursor position in diagram space at the moment of the cut, derived from * the most recent mousemove over the diagram. Ignored when not editable. */ onCut?: ClipboardHandler; /** * Called when a paste event fires on the diagram. The second argument is the * cursor position in diagram space at the moment of the paste, derived from * the most recent mousemove over the diagram. */ onPaste?: ClipboardHandler; } export declare const create: ({ node: nodeRenderer, edge: edgeRenderer, connectionLine: connectionLineRenderer, Provider, }: RendererConfig) => FC; //# sourceMappingURL=Diagram.d.ts.map