import type { ColorToken } from '../../shared/color-token'; export type { ColorToken }; /** A vertex. In an ontology, an individual or a class. */ export interface GraphNode { id: string; label?: string; /** * Class or category. Drives color and the legend, and is the axis an ontology * is usually read along. */ type?: string; /** Overrides the color derived from `type`. */ colorToken?: ColorToken; /** Fixed radius in pixels at unit depth. */ radiusPx?: number; /** Relative weight: bigger values repel harder and draw larger. */ weight?: number; /** Pins the node where it is placed, so the layout arranges the rest around it. */ pinned?: boolean; /** Seed position. Omit to let the layout choose. */ position?: { x: number; y: number; z: number; }; data?: unknown; } /** An edge. In an ontology, the predicate connecting two things. */ export interface GraphEdge { /** Defaults to `"→"`. Give explicit ids for parallel edges. */ id?: string; source: string; target: string; /** The predicate, e.g. `"é subclasse de"`. Drawn when labels are on. */ label?: string; /** Relation kind. Drives color and the legend, like `type` does for nodes. */ relation?: string; colorToken?: ColorToken; /** Draws an arrowhead at the target. Falls back to the graph-level `directed`. */ directed?: boolean; /** Pulls harder and sits shorter at rest. @default 1 */ strength?: number; /** Preferred length at rest, in layout units. */ length?: number; dashed?: boolean; data?: unknown; } /** A node's live position and velocity inside the simulation. */ export interface GraphNodeState { id: string; x: number; y: number; z: number; vx: number; vy: number; vz: number; pinned: boolean; mass: number; } /** What the pointer or keyboard is pointing at. */ export interface GraphFeatureRef { kind: 'node' | 'edge'; id: string; data?: unknown; } export type GraphLayout = '3d' | '2d'; export type GraphLabelMode = 'auto' | 'always' | 'hover' | 'none';