UNPKG

note-graph

Version:

a generic visualization tool designed to show the structure of the document space and the relations between each doc

46 lines (45 loc) 1.09 kB
export declare type NodeId = string | number; export declare type LinkId = string | number; export declare type GraphNode<D> = { id: NodeId; data: D; }; export declare type GraphLink = { id?: LinkId; source: NodeId; target: NodeId; }; export declare type GraphNodeInfo = { title: string; linkIds?: LinkId[]; type?: string; neighbors?: NodeId[]; }; export declare type NoteGraphData = { nodes: Array<{ id: NodeId; }>; links: GraphLink[]; }; /** * Part of the GraphViewModel that can be provided as data input */ export interface GraphViewData { /** data for d3 ForceGraph */ graphData: NoteGraphData; nodeInfos: { [K in NodeId]: GraphNodeInfo; }; focusedNode?: NodeId | null; } /** * states of the NoteGraphView */ export interface GraphViewModel extends GraphViewData { selectedNodes: Set<NodeId>; /** For computing highlight */ focusNodes: Set<NodeId>; hoverNode: NodeId | null; /** For computing highlight */ focusLinks: Set<LinkId>; }