@bernierllc/generic-workflow-ui
Version:
Generic, reusable workflow UI components with linear and graph visualization
88 lines • 2.2 kB
TypeScript
import type { Node, Edge } from '@xyflow/react';
import type { GenericStage, GenericTransition } from '../types';
/**
* Data attached to each workflow node
*/
export interface GenericNodeData<StageMetadata = any> extends Record<string, unknown> {
stage: GenericStage<StageMetadata>;
isActive: boolean;
isCompleted: boolean;
workflowId: string;
}
/**
* Data attached to each workflow edge
*/
export interface GenericEdgeData<TransitionMetadata = any> extends Record<string, unknown> {
transition: GenericTransition<TransitionMetadata>;
isAvailable: boolean;
workflowId: string;
}
/**
* ReactFlow node with workflow-specific data
*/
export type ReactFlowNode<StageMetadata = any> = Node<GenericNodeData<StageMetadata>>;
/**
* ReactFlow edge with workflow-specific data
*/
export type ReactFlowEdge<TransitionMetadata = any> = Edge<GenericEdgeData<TransitionMetadata>>;
/**
* Background pattern variants
*/
export type BackgroundVariant = 'dots' | 'lines' | 'cross' | 'none';
/**
* Node styling options
*/
export interface NodeStyle {
borderWidth?: number;
borderRadius?: number;
padding?: number;
minWidth?: number;
minHeight?: number;
fontSize?: number;
fontWeight?: string | number;
}
/**
* Edge styling options
*/
export interface EdgeStyle {
type?: 'default' | 'straight' | 'step' | 'smoothstep' | 'bezier';
strokeWidth?: number;
animated?: boolean;
markerEnd?: boolean;
}
/**
* Canvas configuration
*/
export interface CanvasConfig {
nodeStyle?: NodeStyle;
edgeStyle?: EdgeStyle;
minimap?: boolean;
controls?: boolean;
background?: BackgroundVariant;
fitView?: boolean;
snapToGrid?: boolean;
gridSize?: number;
nodesDraggable?: boolean;
nodesConnectable?: boolean;
elementsSelectable?: boolean;
}
/**
* Default canvas configuration
*/
export declare const defaultCanvasConfig: Required<CanvasConfig>;
/**
* 2D position for graph nodes
*/
export interface GraphPosition {
x: number;
y: number;
}
/**
* Viewport configuration
*/
export interface ViewportConfig {
x: number;
y: number;
zoom: number;
}
//# sourceMappingURL=canvas-config.d.ts.map