mirror of
https://github.com/OFFIS-ESC/constellation-analyzer
synced 2026-01-27 07:43:41 +00:00
Fixed critical bug where importing a document would lose all timeline states except the current one. Also cleaned up unused legacy persistence functions. Changes: - Import now preserves complete document structure with all timeline states - Export already worked correctly, serializing all timeline states - Updated fileIO to return full ConstellationDocument instead of just graph - Removed unused legacy functions: hasSavedState, getLastSavedTimestamp, clearSavedState - Removed unused graphStore export/import (replaced by workspace-level system) - Updated type definitions to reflect removed functions The import process now correctly: 1. Accepts full ConstellationDocument from imported JSON 2. Preserves all timeline states and relationships 3. Loads complete timeline into timelineStore 4. Maintains document title and metadata 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
88 lines
2.4 KiB
TypeScript
88 lines
2.4 KiB
TypeScript
import { Node, Edge } from 'reactflow';
|
|
|
|
// Node/Actor Types
|
|
export interface ActorData {
|
|
label: string;
|
|
type: string;
|
|
description?: string;
|
|
metadata?: Record<string, unknown>;
|
|
}
|
|
|
|
export type Actor = Node<ActorData>;
|
|
|
|
// Edge/Relation Types
|
|
export type EdgeDirectionality = 'directed' | 'bidirectional' | 'undirected';
|
|
|
|
export interface RelationData {
|
|
label?: string;
|
|
type: string;
|
|
directionality?: EdgeDirectionality;
|
|
strength?: number;
|
|
metadata?: Record<string, unknown>;
|
|
}
|
|
|
|
export type Relation = Edge<RelationData>;
|
|
|
|
// Node Type Configuration
|
|
export interface NodeTypeConfig {
|
|
id: string;
|
|
label: string;
|
|
color: string;
|
|
icon?: string;
|
|
description?: string;
|
|
}
|
|
|
|
// Edge Type Configuration
|
|
export interface EdgeTypeConfig {
|
|
id: string;
|
|
label: string;
|
|
color: string;
|
|
style?: 'solid' | 'dashed' | 'dotted';
|
|
description?: string;
|
|
defaultDirectionality?: EdgeDirectionality;
|
|
}
|
|
|
|
// Graph State
|
|
export interface GraphState {
|
|
nodes: Actor[];
|
|
edges: Relation[];
|
|
nodeTypes: NodeTypeConfig[];
|
|
edgeTypes: EdgeTypeConfig[];
|
|
}
|
|
|
|
// Editor Settings
|
|
export interface EditorSettings {
|
|
snapToGrid: boolean;
|
|
showGrid: boolean;
|
|
gridSize: number;
|
|
panOnDrag: boolean;
|
|
zoomOnScroll: boolean;
|
|
}
|
|
|
|
// Store Actions
|
|
export interface GraphActions {
|
|
addNode: (node: Actor) => void;
|
|
updateNode: (id: string, updates: Partial<Actor>) => void;
|
|
deleteNode: (id: string) => void;
|
|
addEdge: (edge: Relation) => void;
|
|
updateEdge: (id: string, data: Partial<RelationData>) => void;
|
|
deleteEdge: (id: string) => void;
|
|
addNodeType: (nodeType: NodeTypeConfig) => void;
|
|
updateNodeType: (id: string, updates: Partial<Omit<NodeTypeConfig, 'id'>>) => void;
|
|
deleteNodeType: (id: string) => void;
|
|
addEdgeType: (edgeType: EdgeTypeConfig) => void;
|
|
updateEdgeType: (id: string, updates: Partial<Omit<EdgeTypeConfig, 'id'>>) => void;
|
|
deleteEdgeType: (id: string) => void;
|
|
clearGraph: () => void;
|
|
setNodes: (nodes: Actor[]) => void;
|
|
setEdges: (edges: Relation[]) => void;
|
|
setNodeTypes: (nodeTypes: NodeTypeConfig[]) => void;
|
|
setEdgeTypes: (edgeTypes: EdgeTypeConfig[]) => void;
|
|
// NOTE: exportToFile and importFromFile have been removed
|
|
// Import/export is now handled by the workspace-level system (workspaceStore)
|
|
loadGraphState: (data: { nodes: Actor[]; edges: Relation[]; nodeTypes: NodeTypeConfig[]; edgeTypes: EdgeTypeConfig[] }) => void;
|
|
}
|
|
|
|
export interface EditorActions {
|
|
updateSettings: (settings: Partial<EditorSettings>) => void;
|
|
}
|